Hi Leslie,

On Tuesday, July 14, 2015 at 1:38:02 PM UTC+2, leslie...@googlemail.com 
wrote:
>
> When programming with functions this kind of issue is solved quite 
> elegantly by using a for comprehension:
>
>
Not a solution but a comment. In a for comprehension with usual types 
(Future/Option/Either/Try) the calculation is also cut short on the first 
error. So, it may not differ so much in that regard.

However, streams are different in another way: a Flow[T, U] is more than 
just a function T => U, it's more like a T => Seq[U] that can create any 
number of results for any input element. This makes it hard to create 
something like an `eitherFlow(leftFlow: Flow[L, U], rightFlow: Flow[R, U]): 
Flow[Either[L, R], U]` that would bypass errors around some components 
because in general you somehow need to constrain the argument flows to 
produce exactly one output element for each input element. Even then you 
need to prevent two subsequent elements `Right(r)`, `Left(l)` to start a 
race between the left and right branch (if you are interested in keeping 
the order). I think that's the main problem, that it's hard to come with an 
exact specification for a general element that would solve the problem in 
all cases.

akka-http has lots of places where we do pass "control information" around 
actual processing. However, in the end we had to hand-tune the bypass in 
most places because more general solutions didn't work out because of some 
pecularities of the needed semantics.

Johannes

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to