blame: mtl MonadReader instance for ContT

Henning Thielemann lemming at henning-thielemann.de
Tue Dec 23 17:23:19 EST 2008


On Tue, 23 Dec 2008, Henning Thielemann wrote:

> Nicolas Frisby schrieb:
>> This mtl instance is in conflict with a usage of shift/reset that I'm
>> porting from ML (Sheard's type-directed partial evaluator).
>>
>>> 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))
>>
>> I need to remove the "local (const r)" bit. I think this is just a
>> different point in the diverse design space of dynamic
>> binding/delimited control. Since Haskell lacks visibility management
>> for importing instances, I'm forced to duplicate the rest of the ContT
>> code in order to replace this instance with my own.
>
> You may define a newtype, lift all required instances with
> -XGeneralizedNewtypeDeriving and define your own MonadReader instance.

I have put this on:
   http://haskell.org/haskellwiki/Multiple_instances


More information about the Libraries mailing list