Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cabal usage (Haskell)

Cabal has dependency problems constantly. It's really tiring. So far I have tried to get many things working, here's my trying to install snap:

$ sudo cabal install snap-server
Resolving dependencies...
cabal: cannot configure ListLike-1.1.0. It requires mtl >=1.1.0 && 1.2
For the dependency on mtl >=1.1.0 && 1.2 there are these packages:
mtl-1.1.0.0, mtl-1.1.0.1, mtl-1.1.0.2 and mtl-1.1.1.0. However none of them
are available.
mtl-1.1.0.0 was excluded because mtl-2.0.0.0 was selected instead
mtl-1.1.0.0 was excluded because monads-fd-0.1.0.3 requires mtl ==2.*
mtl-1.1.0.1 was excluded because mtl-2.0.0.0 was selected instead
mtl-1.1.0.1 was excluded because monads-fd-0.1.0.3 requires mtl ==2.*
mtl-1.1.0.2 was excluded because mtl-2.0.0.0 was selected instead
mtl-1.1.0.2 was excluded because monads-fd-0.1.0.3 requires mtl ==2.*
mtl-1.1.1.0 was excluded because mtl-2.0.0.0 was selected instead
mtl-1.1.1.0 was excluded because monads-fd-0.1.0.3 requires mtl ==2.*

I have similar problems installing Happstack, etc. What is the procedure to make cabal...work? I've already tried:

export PATH=/home/user/.cabal/bin:$PATH
like image 320
0atman Avatar asked Nov 06 '10 20:11

0atman


People also ask

What is the difference between stack and cabal?

Package versus projectStack is a build tool and it uses Cabal, a build system. Cabal defines the concept of a package. A package has: A name and version.

What is cabal in Linux?

Cabal is a system for building and packaging Haskell libraries and programs. It defines a common interface for package authors and distributors to easily build their applications in a portable way. Cabal is part of a larger infrastructure for distributing, organizing, and cataloging Haskell libraries and programs.

Where is cabal installed?

Using Cabal By default stack installs packages to ~/. cabal and ~/. ghc in your home directory.


1 Answers

The problem is that snap-server-0.2.15 has an unbounded dependency on monads-fd. The most recent version, monads-fd-0.1.0.3, requires mtl-2.* Unfortunately this conflicts with the dependency on ListLike (via iteratee), which requires mtl < 2.0. Both of these constraints can't be fulfilled simultaneously, so cabal gives up.

Try running cabal install snap-server --constrain="monads-fd=0.1.0.2". That will force an earlier version of monads-fd that doesn't require mtl, and I think everything will work properly.

If you're having problems with a lot of packages, it's probably due to the new mtl that was recently uploaded. You can try adding --constrain="mtl<2", which might help.

Moral to maintainers: follow the Haskell PVP and always use upper dependency bounds.

N.B. Even if I do upload a new ListLike that works with mtl-2 (which I'll do very soon), that won't fix your problem because the new ListLike won't be selected due to the upper bound on iteratee.

like image 159
John L Avatar answered Sep 21 '22 17:09

John L