joelpedraza
03/21/2019, 2:09 PMfun <A, B> Deferred<Pair<A, B>>.split(): Pair<Deferred<A>, Deferred<B>>
Is this possible?gildor
03/21/2019, 2:09 PMjoelpedraza
03/21/2019, 2:10 PMgildor
03/21/2019, 2:10 PMgildor
03/21/2019, 2:11 PMjoelpedraza
03/21/2019, 2:11 PMA
and B
, Consumer may need A
, B
, A && B
, or neither and won’t know which until runtimejoelpedraza
03/21/2019, 2:12 PMgildor
03/21/2019, 2:13 PMasync { val (a, _) = await(); a } to async { val (_, b) = await(); b }
gildor
03/21/2019, 2:13 PMstreetsofboston
03/21/2019, 2:13 PMjoelpedraza
03/21/2019, 2:13 PMgildor
03/21/2019, 2:13 PMgildor
03/21/2019, 2:14 PMgildor
03/21/2019, 2:17 PMjoelpedraza
03/21/2019, 2:20 PMjoelpedraza
03/21/2019, 2:21 PMA
or B
but dont know at the time the consumer starts aggregating datastreetsofboston
03/21/2019, 2:26 PMResult<out A, out B>
with sub-types Left<out A> : Result<A, Nothing>
, Right<out B> : Result<Nothing, B>
, Both<out A, out B> : Result<A,B>
and None : Result<Nothing, Nothing>
?streetsofboston
03/21/2019, 2:27 PMraulraja
03/21/2019, 5:25 PMraulraja
03/21/2019, 5:26 PMraulraja
03/21/2019, 5:26 PMraulraja
03/21/2019, 5:27 PMraulraja
03/21/2019, 5:27 PMgildor
03/22/2019, 1:22 AMBut there is the case where the consumer does not need the data from the producer at allI would start from another question: what is your use case to have Deferred?