
13 Apr
2007
13 Apr
'07
5:12 a.m.
Hi all, for my current project I need a monad that is an instance of MonadIO, MonadReader, MonadWriter, MonadState, and MonadError. I see two ways for defining such a monad using the mtl. 1) type MyMonad = ErrorT E (RWST R W S IO) and 2) type MyMonad = RWST R W S (ErrorT E IO) I can't figure out what is the difference between these two definitions and therefore which one is more suitable for my problem. Or are the equivalent and it is unimportant which one I use? Or is it even better define a new type like newtype MyMonad a = MyMonad { runMyMonad :: R -> S -> IO (Either E a,S,W) } and declare instances for all 5 type classes? Thanks for your help in advance, Martin.