Adding IdentityT to mtl

Donald Bruce Stewart dons at
Fri Jun 1 23:37:07 EDT 2007

> Hi,
> Just curious, could you say a bit more about what you plan to use this for?

Yes, in Xmonad, we're considering a flexible way for users to extend the
application. One way would be to provide their own monad transformer
(so they could thread state, or add new effects and so on). 

The ticket for this is here:

Current xmonad runs in:

     newtype X a = X (ReaderT XConf (StateT XState IO) a)

but we'd allow user-specified state, or logging , or so on with,

     newtype X a = X (ReaderT XConf (StateT XState (UserT IO)) a)
by default though, UserT would be:

     type UserT = IdentityT
     runUserT    :: Monad m => UserT m a -> m a

but could be, say,

    type UserT = StateT UserState

> By the way, if IdentityT is added, then it should have instances for
> all the classes---Reader,Writer,etc.   Also the Functor instance does
> not need the Monad constraint on "m".

Yes, that's just a quick draft. It would need the other instances.

Seems useful?

-- Don

More information about the Libraries mailing list