Daniel K
Daniel K

Reputation: 907

Why does building lens fail? I'm using stackage

I'm using the latest stackage, published on 2014-09-15.

remote-repo: stackage:http://www.stackage.org/stackage/77b7fb7541411b7c50b0f7cdd3ac8ef833bcaeee

When I do cabal install lens -v3 I get an unresolved dependency error:

[_14] trying: transformers-compat-0.3.3.4 (dependency of lens-4.1.2.1)
[_15] trying: transformers-compat-0.3.3.4:-two
[_16] trying: transformers-compat-0.3.3.4:-three
[_17] next goal: transformers (dependency of lens-4.1.2.1)
[_17] rejecting: transformers-0.3.0.0/installed-16a..., 0.3.0.0 (conflict: transformers-compat-0.3.3.4:three => transformers>=0.4.1)
[_17] fail (backjumping, conflict set: lens, transformers, transformers-compat, transformers-compat-0.3.3.4:flag)
[_16] rejecting: transformers-compat-0.3.3.4:+three (manual flag can only be changed explicitly)
[_16] fail (backjumping, conflict set: lens, transformers, transformers-compat, transformers-compat-0.3.3.4:flag)
[_15] rejecting: transformers-compat-0.3.3.4:+two (manual flag can only be changed explicitly)
[__0] fail (backjumping, conflict set: lens, transformers, transformers-compat, transformers-compat-0.3.3.4:flag)
cabal: Could not resolve dependencies:
trying: lens-4.1.2.1 (user goal)
trying: transformers-compat-0.3.3.4 (dependency of lens-4.1.2.1)
next goal: transformers (dependency of lens-4.1.2.1)
rejecting: transformers-0.3.0.0/installed-16a..., 0.3.0.0 (conflict:
transformers-compat-0.3.3.4:three => transformers>=0.4.1)
Dependency tree exhaustively searched.

I thought this was impossible when using stackage?

my setup

I'm using ghc 7.8.3, downloaded from the website. The only global packages are those installed when I did ghc installation:

~/.cabal> ghc-pkg list --global
/opt/ghc-7.8.3/lib/ghc-7.8.3/package.conf.d
   Cabal-1.18.1.3
   array-0.5.0.0
   base-4.7.0.1
   bin-package-db-0.0.0.0
   binary-0.7.1.0
   bytestring-0.10.4.0
   containers-0.5.5.1
   deepseq-1.3.0.2
   directory-1.2.1.0
   filepath-1.3.0.2
   ghc-7.8.3
   ghc-prim-0.3.1.0
   haskeline-0.7.1.2
   haskell2010-1.1.2.0
   haskell98-2.0.0.3
   hoopl-3.10.0.1
   hpc-0.6.0.1
   integer-gmp-0.5.1.0
   old-locale-1.0.0.6
   old-time-1.1.0.2
   pretty-1.1.1.1
   process-1.2.0.0
   rts-1.0
   template-haskell-2.9.0.0
   terminfo-0.4.0.0
   time-1.4.2
   transformers-0.3.0.0
   unix-2.7.0.1
   xhtml-3000.2.1

My user package list is empty:

~/.cabal> ghc-pkg list --user
~/.cabal> 

I peeked inside ~/.cabal/packages/stackage/00-index.cache and noticed that only the 0.3.0.0 version of transformers is listed:

pkg: transformers 0.3.0.0 b# 184196

lens-4.1.2.1 requires transformers-compat-0.3.3.4 which requires transformers >= 0.4.1 This leaves me confused; how would this ever build when the only version of transformers listed is 0.3.0.0?

and later it works

I installed some other packages and now an attempt to install lens works. Here's what I have already installed when my attempt to install lens succeeds. transformers-compat-0.3.3.4 being already installed must have something to do with it.

~/.cabal> ghc-pkg list --user
   Boolean-0.2.1
   MemoTrie-0.6.2
   NumInstances-1.3
   QuickCheck-2.6
   ReadArgs-1.2.1
   aeson-0.7.0.4
   attoparsec-0.10.4.0
   base-unicode-symbols-0.2.2.4
   basic-prelude-0.3.8
   byteable-0.1.1
   comonad-4.2.2
   contravariant-0.6.1.1
   distributive-0.4.4
   dlist-0.7.1
   exceptions-0.6.1
   hashable-1.2.2.0
   lifted-base-0.2.2.1
   monad-control-0.3.3.0
   mtl-2.1.3.1
   nats-0.2
   parallel-3.2.0.4
   prelude-extras-0.4
   primitive-0.5.2.1
   profunctors-4.2.0.1
   random-1.0.1.1
   reflection-1.5.1
   safe-0.3.8
   scientific-0.2.0.2
   semigroupoids-4.0.4
   semigroups-0.15.3
   split-0.2.2
   stm-2.4.2
   syb-0.4.1
   system-filepath-0.4.12
   tagged-0.7.2
   text-1.1.0.0
   transformers-base-0.4.3
   transformers-compat-0.3.3.4
   unordered-containers-0.2.4.0
   utf8-string-0.3.8
   vector-0.10.9.1
   vector-space-0.8.7
   vector-th-unbox-0.2.1.0
   void-0.6.1
   zlib-0.5.4.1

I think transformers-compat-0.3.3.4 was able to install because of these lines, found in its cabal file.

flag three   default: False   manual: True   description: Use
transformers 0.3. This should toggle on/off automatically.

library
  build-depends:
    base >= 4.3 && < 5

  if flag(three)
    hs-source-dirs: 0.3
    build-depends: transformers >= 0.3 && < 0.4

I don't know how cabal flags work exactly. I'm assuming some other package I installed knows to set flag=3 but lens does not? That would be unexpected, since Edward Kmett is the author of both of these.

Upvotes: 1

Views: 247

Answers (1)

Michael Snoyman
Michael Snoyman

Reputation: 31355

transformers-compat has caused a lot of issues, since it's triggered bugs in the cabal dependency solver. I'll try pinning down the transformers-compat version better in stackage. I think follow up on this would be more easily handled in a stackage github issue.

Upvotes: 0

Related Questions