transient-haskell / transient

A full stack, reactive architecture for general purpose programming. Algebraic and monadically composable primitives for concurrency, parallelism, event handling, transactions, multithreading, Web, and distributed computing with complete de-inversion of control (No callbacks, no blocking, pure state)
MIT License
630 stars 28 forks source link

Strange hang with applicative code #73

Closed mitchellwrosen closed 5 years ago

mitchellwrosen commented 6 years ago

Hi, I have been reading through the transient tutorial and I happened upon a strange hang induced by the following code:

main = keep (((,) <$> async (print 1) <*> liftIO (print 2)) *> liftIO (print 3))

For some reason, this prints 1 and 2, but never 3. However, using do-notation works fine:

main = keep $ do
  _ <- (,) <$> async (print 1) <*> liftIO (print 2)
  liftIO (print 3)

Any idea what might be going on? Thank you!

agocorona commented 6 years ago

It run well in my box. what are your versions, platform ?

mitchellwrosen commented 6 years ago

Huh, now my example works fine for me, too. Maybe @seagreen or @nicklawls can reproduce the hang but I can't.