I tried to import the Control.Monad.Writer
module like this:
import Control.Monad.Writer
ghc
version 7.4.1 gives the following error:
Ambiguous module name `Control.Monad.Writer':
it was found in multiple packages: monads-tf-0.1.0.1 mtl-2.1.1
There is a question with a similar problem and a workaround here.
Despite the solution given in this thread my questions are:
Is this the standard configuration of cabal and ghc?
- If so: is there a reason for the module to be in two packages by default?
- If not: what (might have) happened and can it be undone?
If that matters: I'm working on Debian 7.3 wheezy and installed the haskell-platform
package. Further, I installed some packages using cabal install
.
Many thanks in advance!
Yes, this is "standard". The reason is a historic refactoring of the
mtl
package to accomodate two different styles of handling type classes with multiple parameters, like theMonadWriter
class : type families and functional dependencies.The
mtl
package retains the older functional dependencies approach, whereasmonads-tf
has the newer type families approach.As there are now libraries in the Haskell ecosystem that use
monads-tf
, it's inevitable that both will end up in the package database on typical installations - I've personally been experiencing it for several weeks.