by DanWaterworth · 14y ago · 0 comments
forever :: Monad m => m a -> m a
I can use it for either asynchronous or synchronous javascript, e.g forever :: IO a -> IO a
forever :: ContT r IO a -> ContT r IO a
The same function can take a synchronous js function or an async js function and run it in an infinite loop. For this reason, I think that if you want to learn from Haskell in writing reusable js then you should look into monads. forever :: Monad m => m a -> m b
Since it never returns a value, the resulting monadic action can be polymorphic in its return type.