
29 Nov
2013
29 Nov
'13
12:47 p.m.
On 29.11.2013 13:42, Ivan Lazar Miljenovic wrote:
On 29 November 2013 23:35, David Luposchainsky
wrote: Async is a Functor (but not Applicative). When asyncs finish and you poll their result with `wait`, you potentially get back an IO <thunk>. (Just the first example that came to mind.)
Except wait :: Async a -> IO a, so it's actually in the IO monad (which _is_ a monad :p).
Sure, but now you're in IO (and can $! in IO of course). But sometimes you may not want to `wait` just yet, and evaluate the Async's eventual result directly to WHNF, so that if you then `wait`, you get an already evaluated thing in IO.