blame: mtl MonadReader instance for ContT

Chung-chieh Shan ccshan at
Sat Dec 27 18:14:04 EST 2008

Nicolas Frisby <nicolas.frisby at> wrote in article <5ce89fb50812221019p49bdf464rc78c1cdade5099ed at> in gmane.comp.lang.haskell.libraries:
> > instance (MonadReader r' m) => MonadReader r' (ContT r m) where
> >     local f m = ContT $ \c -> do
> >         r <- ask
> >         local f (runContT m (local (const r) . c))
> 1) I am hoping this list can recall the reason for putting this design
> decision into the mtl. Perhaps there's a reason to prefer this
> particular side-effect interaction.

For what it's worth, this interaction is justified in Section 8.4 of:
Sheng Liang, Paul Hudak, and Mark Jones. 1995.  Monad transformers and
modular interpreters.  In POPL '95: Conference record of the annual ACM
symposium on principles of programming languages, 333-343. New York:
ACM Press.

Edit this signature at
100 Days to close Guantanamo and end torture

More information about the Libraries mailing list