MTL vs Transformers. Any status update?
wren ng thornton
wren at community.haskell.org
Mon Nov 30 03:03:08 EST 2009
Edward Kmett wrote:
> As a straw man proposal to get things started:
> Control.Monad.Foo.Transformer - for the actual data type for FooT
> mtl 2:
> Control.Monad.Foo.Class - exports just the fundep-based typeclass and no
> instances, like now.
> Control.Monad.Foo - exports the instances for the fundep based version and
> re-exports the Transformer and Class module contents.
> Control.Monad.Foo.Family.Class - exports just the type-family based
> Control.Monad.Foo.Family - exports the instances of the typefamily base
> version and re-exports the Transformer and Family.Class modules
> This will safely let most libraries just use a constraint on mtl >= 1.2 &&
> <= 2.1 in which case their code works across both versions, and if someone
> wants to use mtl-tf for clarity in their code, it will introduce no
> complications regardless of what libraries they import as long as those
> libraries can support both versions.
It's consistent and avoids name-clashery, which is nice. But I thought
transformers had everything in one file? Maybe I'm thinking of a
different monad transformer library...
I think keeping fundeps as the default is probably best. It maintains
instance definitions in old code across the version boundary, and it
also maintains support with Hugs for folks who care about that.
If, in the future, the community decides that fundeps are bad and TFs
are good then we can make that switch in mtl-3. Even though a lot of
folks are leaning that way now, I don't think there's a clear consensus
yet to deprecate fundeps. Conflating the fundep-vs-TF debate in with the
mtl-vs-transformers debate is just going to drag things out longer IMO.
More information about the Libraries