[Haskell-cafe] MonadPeelIO instance for monad transformers on top of "forall"

Anders Kaseorg andersk at MIT.EDU
Fri Feb 4 22:41:39 CET 2011

On Fri, 4 Feb 2011, Max Bolingbroke wrote:
> data M a = M { unM :: forall m. MonadPeelIO m => Reader.ReaderT () m a }

Maybe this won’t help in your actual code, but isn’t M isomorphic to IO 
(via unM :: M a -> IO a, M . liftIO :: IO a -> M a)?

instance MonadPeelIO M where
  peelIO = M (liftIO (liftM (\k (M mx) -> liftM (\my -> (M (liftIO my))) (k mx)) peelIO))


More information about the Haskell-Cafe mailing list