blame: mtl MonadReader instance for ContT

Chung-chieh Shan ccshan at post.harvard.edu
Sat Dec 27 18:14:04 EST 2008


Nicolas Frisby <nicolas.frisby at gmail.com> wrote in article <5ce89fb50812221019p49bdf464rc78c1cdade5099ed at mail.gmail.com> 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.  http://web.cecs.pdx.edu/~mpj/pubs/modinterp.html

-- 
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
100 Days to close Guantanamo and end torture http://100dayscampaign.org/



More information about the Libraries mailing list