
30 Jan
2008
30 Jan
'08
4:01 a.m.
Are monad stacks with 3 and more monads common? How could an example implementation look like?
I found reading the xmonad code (http://code.haskell.org/xmonad/) enlightening. The X monad definition can be found in http://code.haskell.org/xmonad/XMonad/Core.hs -- | The X monad, a StateT transformer over IO encapsulating the window -- manager state -- -- Dynamic components may be retrieved with 'get', static components -- with 'ask'. With newtype deriving we get readers and state monads -- instantiated on XConf and XState automatically. -- newtype X a = X (ReaderT XConf (StateT XState IO) a) deriving (Functor, Monad, MonadIO, MonadState XState, MonadReader XConf) -- Johan