8

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
0atman
  • 3,298
  • 4
  • 30
  • 46

1 Answers1

7

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.

John L
  • 27,937
  • 4
  • 73
  • 88
  • "Even if I do upload a new ListLike..., that won't fix your problem" Moral: never use upper bounds. Joke :) Look like we need something more stable then hackage and less stable then HP. Something in between. – Yuras Nov 06 '10 at 22:36
  • 1
    @Yuras, I agree (and I realized that upper bounds prevented one solution while I was typing). If hackage required upper bounds on everything, it would go a long way to improving stability. The more I work with cabal and version numbers, the more convinced I am that autotools got it right. – John L Nov 06 '10 at 23:01
  • Yikes, cabal requires a lot of knowledge about the packages to use! That makes me sad :-( – 0atman Nov 07 '10 at 15:22
  • 1
    Although thanks to this, I was able to install by --reinstall ing all the dependencies that had been broken. Thanks! – 0atman Nov 07 '10 at 16:07
  • distro packages - if they exist for your world - are hopefully the middle ground you seek – Ganesh Sittampalam Nov 07 '10 at 23:18