[Haskell-cafe] Lifting IO (IO a) -> IO a to m (m a) -> m a with monad-control

Edward Z. Yang ezyang at MIT.EDU
Wed Jan 18 15:59:29 CET 2012

Hello folks,

I was curious whether or not it is possible to lift an arbitrary
IO (IO a) -> IO a function to MonadBaseControl IO m => m (m a) -> m a.
That is, implement a function:

liftJoin :: MonadBaseControl mb m => (mb (mb (StM m a)) -> mb (StM m a)) -> m (m a) -> m a

The difficulty seems to be that we can't extract the resumable state from the inner
base monad action.

If this is not possible, is there a suitable strengthening of MonadBaseControl
that achieves this effect?


[1] http://hackage.haskell.org/packages/archive/monad-control/latest/doc/html/Control-Monad-Trans-Control.html

More information about the Haskell-Cafe mailing list