Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Control.Monad.Writer found in multiple packages haskell

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!

like image 256
jules Avatar asked Jan 15 '14 17:01

jules


1 Answers

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 the MonadWriter class : type families and functional dependencies.

The mtl package retains the older functional dependencies approach, whereas monads-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.

like image 117
GS - Apologise to Monica Avatar answered Nov 18 '22 19:11

GS - Apologise to Monica