0

I was trying to use cabal to install mtl while it told me I missed transformers ==0.4.* && ==0.5.2.0.

$ cabal install mtl
Resolving dependencies...
Configuring mtl-2.2.1...
cabal.exe: At least the following dependencies are missing:
transformers ==0.4.* && ==0.5.2.0
cabal.exe: Error: some packages failed to install:
mtl-2.2.1 failed during the configure step. The exception was:
ExitFailure 1

I stuck here for almost one week. I've installed transformers in version 0.4.3.0 and 0.5.2.0. My cabal is in version 1.10.2.0 and my ghc is 7.6.3. I'm new to ghc so I can't figure out what is the problem. I can't understand what the transformers ==0.4.* means. Any suggestions? Thanks a lot!

1 Answers1

2

The line

transformers ==0.4.* && ==0.5.2.0

is a dependency constraint on the version of the transformers library. Here it states that it requires that the transformers version is at the same time 0.4.* and 0.5.2.0. Although there can be different versions installed, during compilation only one version can be used—therefore, this constraint can never be satisfied.

For some reasons, cabal seems to get confused with the two revisions of the mtl package. The second revision adds support for transformers-5. See also issue 30 of mtl, where it is noted that the metadata of hackage is the second revision, but the source tarball that is finally downloaded is the original revision.

Until a new version of mtl is released, you have to explicitly install transformers-0.4.3.0 (and only that version) and then install mtl.

cabal install transformers-0.4.3.0

If the dependencies are satisfied when installing mtl, transformers-0.4.3.0 will pass the dependency check. It seems that cabal automatically adds the latest version as a dependency (e.g. == transformers-0.5.2.0) when that version is installed. Therefore, only 0.4.* versions should be installed.

If you have already installed the latest transformers version, you can uninstall it:

ghc-pkg unregister --force transformers-0.5.2.0
rm -r .cabal/packages/hackage.haskell.org/transformers/0.5.2.0

(Do this for every 5.x version that is installed, see cabal info transformers for a list of installed version.)

Community
  • 1
  • 1
Martin Nyolt
  • 4,463
  • 3
  • 28
  • 36