Fwd: transformers versus mtl

Alexander Dunlap alexander.dunlap at gmail.com
Tue Mar 24 20:36:26 EDT 2009


On Tue, Mar 24, 2009 at 4:39 PM, Isaac Dupree
<ml at isaac.cedarswampstudios.org> wrote:
> Iavor Diatchki wrote:
>> On Tue, Mar 24, 2009 at 2:42 PM, Sittampalam, Ganesh
>>
>> <ganesh.sittampalam at credit-suisse.com> wrote:
>> > Sittampalam, Ganesh wrote:
>> > ...the Functor instances for
>> > ReaderT r m and WriterT w m now (correctly) depend on Functor m,
>> > whereas in mtl they depend on Monad m.
>>
>> ...?On the other hand, with the unfortunate lack of
>> relation between Functor and Monad in Haskell, it seems these
>> instances will not work if I try to transform a monad that does not
>> have a functor instance.
>
> well, if base monad `m` is not a Functor, then it seems decidedly odd to me
> for the transformed monad to become a Functor... the transformer would be
> doing more than you'd expect!  But if you don't use (Functor (ReaderT r m)),
> only (Monad (ReaderT r m)), perhaps it works as well as could be expected?
> (Or maybe it doesn't work after all; then my logic here is useless)
>
> -Isaac
>

I'm pretty sure all monads are functors.

Alex


More information about the Libraries mailing list