Move MonadIO to base

Anders Kaseorg andersk at MIT.EDU
Fri Apr 23 13:39:36 EDT 2010

On Fri, 23 Apr 2010, Tyson Whitehead wrote:
> Are you then saying that liftIO should be able to be defined via 
> morphIO?  I would be curious to see that as, after a bit of trying, I 
> still can't see how to.  Specifically, I can't capture the results of 
> the desired IO operation.

Yes, just like lift is defined via morph:

liftIO' :: (MonadMorphIO m) => IO a -> m a
liftIO' m = morphIO $ \down -> m >>= down . return

main = runContT (runReaderT main' ()) return
main' = do
  liftIO' $ putStrLn "What is your name?"
  name <- liftIO' $ getLine
  liftIO' $ putStrLn $ "Hello " ++ name


More information about the Libraries mailing list