
23 Aug
2011
23 Aug
'11
11:53 a.m.
Hi. Daniel already answered the question; here is an alternative definition for the loadConfig function he gave. Uses type-classes and liftIO. I find it easier to use type-classes when dealing with monad transformers, especially if you have more than a couple of them. You get automatic lifting for every monad transformer in the stack except IO, for which you need to use liftIO. Please ask if you have any questions. loadConfig :: (MonadError MyError m, MonadIO m) => String -> m Config loadConfig _ = do liftIO $ putStrLn "foo" throwError ConfigError HTH, Ozgur