Could iteratee depend on mtl instead of transformers?

Ross Paterson ross at
Wed Nov 18 19:28:38 EST 2009

On Wed, Nov 18, 2009 at 06:04:24PM +0000, Duncan Coutts wrote:
> Ross, if the plan is to have the new combined package be mtl-2.x then
> you might as well go ahead and modify the preferred-versions file to
> add:
> mtl < 2
> Then cabal-install will then use the old mtl for all the old packages
> that do not use an upper bound.
> We should also add mtl to the list packages to check in
> Distribution/PackageDescription/Check.hs. At the moment it's hard-coded
> to be a list of 1 (base), so that'd need doing too. This would
> eventually be replaced by a generic way of opting into the regime.
> Or, if you all think the amount of breakage is not that great, and it'd
> be simpler just to fix the packages affected, then do nothing :-)

I've just realized that it's not going to be as painless as we thought,
and I'm not sure this is something preferred-versions can help with.
(But I still think the transition is worth doing.)

My original plan was to refactor mtl as transformers + monads-fd, so
that together they'd offer a bunch of modules that were near-compatible
with the modules of the same name in mtl.  In only a tiny minority of
cases would it be necessary to change code, but everyone would have to
replace their dependencies on mtl with dependencies on transformers and
monads-fd (though the latter wouldn't always be needed).

Then Ganesh whipped up an mtl compatibility package, that re-exported
modules from the two packages.  Almost all the packages in hackage would
compile unchanged if this package was mtl-2.0.  But there's a problem:
even if we rename the modules in monads-fd, we still have two modules
in transformers that have the same names as modules in mtl, namely
Control.Monad.Identity and Control.Monad.Trans.  Renaming isn't an
option: at least the first of those is the Right Name for the module
concerned.  People who build with cabal are fine: only the dependent
packages are exposed, and all packages use the same type constructors,
so the interfaces are compatible.  But people who build with ghci or
ghc --make will get the error message at the top of this thread:

    Could not find module `Control.Monad.Identity':
      it was found in multiple packages: mtl-2.0 transformers-

So I think we're back at the original plan: a big bang replacement of
dependencies on mtl with dependencies on transformers and monads-fd.
(Unless we introduce virtual packages.)

After that we could rename the FD-using modules slowly using the usual
deprecation procedure.  But we should rename the modules in monads-tf
now -- all that needs is for someone to suggest good names.

> If you are modifying the preferred-versions file, would you mind
> sticking in:
> cabal-install < 0.8


More information about the Libraries mailing list