Future, akka-stream, scalaz-stream
@viktorklang Haven’t seen it. Is there video somewhere?
2014-09-20 09:19:23@djspiewak Sadly no. Watching mine and Roland's ScalaDays 2014 talk will give most of the explanation though.
2014-09-20 09:21:28@djspiewak at youtube.com/watch?feature=… you are assuming that ECs aren't trampolinable. scalaz.Task seem to hog current Thread during eval?
2014-09-20 09:23:57@viktorklang It doesn’t have to hog the current thread (runAsync is the not-selfish one). I don’t use run very often though (just endpoints)
2014-09-20 09:26:00@viktorklang Task does use the same thread as you flatMap through though. This achieves much higher efficiency and thread utilization.
2014-09-20 09:26:39@viktorklang You can kick a Task into a different thread pool using Task.apply instead of delay.
2014-09-20 09:27:04@djspiewak Yes, and it will still hog a thread in that threadpool until full eval? Using trampolining you can tune fairness vs throughput.
2014-09-20 09:31:24@viktorklang Yes, that’s the tradeoff. You can kick back to the executor explicitly using Task.fork, but it is explicit.
2014-09-20 09:32:04@viktorklang I think this is a reasonable tradeoff given that Task users tend to flatMap a lot more with much smaller units.
2014-09-20 09:32:33@djspiewak IMO ECs give the best of both worlds, and does not rely on the user to fiddle with the demarcation. github.com/scala/scala/bl…
2014-09-20 09:35:48@viktorklang This is true, but then you have to pass the EC around everywhere and you lose abstraction over the monad.
2014-09-20 09:36:54@djspiewak And you did not tell us?! Thanks "buddy"! @runarorama and I are now watching @strangeloop_stl from a distance :(
2014-09-20 09:36:59@viktorklang @runarorama @strangeloop_stl LOL. Next time!
2014-09-20 09:37:33@runarorama @viktorklang @strangeloop_stl How very Norse of you both…
2014-09-20 09:37:57@djspiewak I think I'll regret saying this but I guess you could have an ExecutionContext monad transformer…
2014-09-20 09:38:30@viktorklang LOL. You sort of could. More likely, you would wrap Future to have a real flatMap and carry a “current” EC along for the ride.
2014-09-20 09:39:35@viktorklang Scalaz does define a monad for Scala’s Future, but it misses out on some features (like changing ECs).
2014-09-20 09:41:32@a4dev Super simple: (implicit ec: ExecutionContext), add it to all methods w. Futures, pass EC in at the end of the world. /cc @djspiewak
2014-09-20 10:31:13@viktorklang @a4dev Unless you have methods that manipulate futures via abstractions and don’t know about EC.
2014-09-20 10:33:10@djspiewak I chucked when you mentioned Netty and handshakes. (from one who also lived to tell the tale) :)
2014-09-20 10:34:37@viktorklang @a4dev The traverse function in Scalaz. Or really anything that uses Monad (or its ancestry).
2014-09-20 10:34:59@viktorklang Netty handshakes are amazingly bad. I didn’t even realize software could be so awful…
2014-09-20 10:35:30@viktorklang It sure is pretty with the streams interface though. A handshake is just another step in the for comprehension.
2014-09-20 10:35:55@djspiewak Sounds like a library-induced limitation ;-) /cc @a4dev
2014-09-20 10:36:55