
14 Mar
2007
14 Mar
'07
12:40 p.m.
Chris Kuklewicz
Searching the haskell wiki for MonadIO gives several examples.
http://haskell.org/haskellwiki/New_monads/MonadExit
instance MonadIO m => MonadIO (ExitT e m) where liftIO = lift . liftIO
Where you can see you are just delegating the work of the transformer to the underlying monad. Eventually it hits the bottom of the stack and sees:
instance MonadIO IO where liftIO = id
Ah, so to combine my monad with IO i need to write a monad Transformer (TransactionT), then I can make it an instance of MonadIO? I found examples like the ones you gave but the whole transformer-part got me a bit confused. Sorry, should have spent some more time reading before asking.