My installed transformers version is not considered by cabal-install

Deadly 提交于 2021-02-07 22:38:11

问题


I am totally new to Haskell an cabal and I'm trying to make yesod work.

My cabal version is cabal-install version 1.20.0.3 using version 1.20.0.2 of the Cabal library

This is what happends when I tru to install alex:

$ cabal install alex
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: alex-3.1.4 (user goal)
next goal: QuickCheck (dependency of alex-3.1.4)
rejecting: QuickCheck-2.8.1, 2.8 (global constraint requires ==2.7.6)
trying: QuickCheck-2.7.6
next goal: transformers (dependency of QuickCheck-2.7.6)
rejecting: transformers-0.4.3.0, 0.4.2.0, 0.4.1.0, 0.3.0.0, 0.2.2.1, 0.2.2.0,
0.2.1.0, 0.2.0.0, 0.1.4.0, 0.1.3.0, 0.1.1.0, 0.1.0.1, 0.1.0.0, 0.0.1.0,
0.0.0.0, 0.4.0.0 (global constraint requires installed instance)
Dependency tree exhaustively searched.

Second attempt:

$ cabal install alex happy yesod-bin --allow-newer
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: alex-3.1.4 (user goal)
trying: QuickCheck-2.7.6/installed-1a8... (dependency of alex-3.1.4)
trying: tf-random-0.5/installed-ef3... (dependency of
QuickCheck-2.7.6/installed-1a8...)
next goal: primitive (dependency of tf-random-0.5/installed-ef3...)
rejecting: primitive-0.5.0.1/installed-8e5... (global constraint requires
==0.6)
rejecting: primitive-0.6 (conflict: tf-random =>
primitive==0.5.0.1/installed-8e5...)
rejecting: primitive-0.5.4.0, 0.5.3.0, 0.5.2.1, 0.5.1.0, 0.5.0.1, 0.5, 0.4.1,
0.4.0.1, 0.4, 0.3.1, 0.3, 0.2.1, 0.2, 0.1 (global constraint requires ==0.6)
Dependency tree exhaustively searched.

What do I have to do to install alex?

A related question is this one: cabal install --- global constraint requires installed instance

The comment by @kosmikus on that question is:

So the Stackage LTS config file contains the constraint transformers installed, meaning that only an already present version of transformers can be used. This is reasonable, because GHC ships with a specific version of transformers. For ghc-7.8, this is transformers-0.3.0.0. For some reason, this installed version is not considered by cabal-install. Your partial log doesn't contain sufficient info to see why.

How can I fix my Stackage LTS config file? Where is it on Ubuntu?


回答1:


Try this cabal install alex --allow-newer




回答2:


The reason of the problem was that my GHC was too old. I downloaded a newer version and solved the problem.

Failed (and wrong) attempt

You should have a cabal.config file in your current directory. Open it with any text editor and serach for the transformers installed string.

Once you have found it, replace it with transformers ==0.4.3.0 or any other version you like.

It is a bad solution, because, as dfeurer writes:

transformers sits very far down in the package dependency structure. I believe it depends only on base; I imagine a large majority of packages on Hackage depend, directly or indirectly, on it. If you upgrade transformers, practically every dependency in the system will go screwy, which is the opposite of what you're going for if you're using Stackage.


Clean solution by Sibi

Use the stackage packages as it is. If you have some global package causing problem, then remove them and use stackage exclusively. Also using sandbox for each project is a good idea.



来源:https://stackoverflow.com/questions/30557459/my-installed-transformers-version-is-not-considered-by-cabal-install

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!