
25 Jun
2009
25 Jun
'09
8:16 a.m.
Hi all, I'm puzzled by something. Suppose I have some code that does lots of IO, and also occasionally refers to some global state. No problem, use ReaderT for the state, combining with the IO monad. Except... since IO is on the bottom, simple uses of do-notation such as "foo <- ask" work in the Reader monad, and to access the IO monad, I need to lift, e.g. (bar <- liftIO getLine). If my code does lots of IO, this is *very* ugly -- the code is littered with lift functions! Is there no cleaner way to do this? Thanks, - Richard