2

I'm creating a new Haskell project using Stack 0.1.3.1 on Windows 8. My stack.yaml file looks like this:

flags: {}
packages:
- 'lazy-engine'
extra-deps: []
resolver: lts-3.4

When I run stack build or stack test, everything works beautifully. I can run haddock manually from the command line and that works, too. But when I run stack haddock I get output like this:

Setting codepage to UTF-8 (65001) to ensure correct output from GHC
NOTE: the haddock command is functionally equivalent to 'build --haddock'
While constructing the BuildPlan the following exceptions were encountered:

--  Failure when adding dependencies:
      base: needed (>=4.5 && <4.9), latest is 4.8.1.0, but not present in build plan
    needed for package: array-0.5.1.0

--  While attempting to add dependency,
    Could not find package base in known packages

--  Failure when adding dependencies:
      array: needed (-any), latest is 0.5.1.0, but couldn't resolve its dependencies
      base: needed (>=4.2 && <5), latest is 4.8.1.0, but not present in build plan
      deepseq: needed (>=1.2 && <1.5), latest is 1.4.1.2, but couldn't resolve its dependencies
      ghc-prim: needed (-any), latest is 0.4.0.0, but not present in build plan
    needed for package: containers-0.5.6.2

--  Failure when adding dependencies:
      array: needed (>=0.3 && <0.6), latest is 0.5.1.0, but couldn't resolve its dependencies
      base: needed (==4.3.* || >=4.5 && <4.9), latest is 4.8.1.0, but not present in build plan
    needed for package: deepseq-1.4.1.1

--  While attempting to add dependency,
    Could not find package ghc-prim in known packages

--  Failure when adding dependencies:
      base: needed (>=4.7 && <5), latest is 4.8.1.0, but not present in build plan
      containers: needed (==0.5.*), latest is 0.5.6.3, but couldn't resolve its dependencies
    needed for package: lazy-engine-0.1.0.0

Recommended action: try adding the following to your extra-deps in 
    C:\Users\Aaron\Documents\GitHub\lazy-engine\stack.yaml
- base-4.8.1.0
- ghc-prim-0.4.0.0

You may also want to try the 'stack solver' command

Obviously this is nonsense—I shouldn't have to add base to my extra-deps, especially since I'm working off an LTS package set! What is going on here?

Update: As discussed in the answer below, this seems to have been a bug in stack and should be fixed in newer versions. See https://github.com/fpco/minghc/issues/85.

Community
  • 1
  • 1
Aaron Rotenberg
  • 972
  • 7
  • 22

2 Answers2

4

A guess: you're using a GHC install that does not include documentation, or at least not as stack expects it to be discovered. Can you try with "--install-ghc --no-system-ghc"? I may have the specific flag names wrong.

Also, how is GHC installed on your system?

Michael Snoyman
  • 31,100
  • 3
  • 48
  • 77
  • `--install-ghc --no-system-ghc` made it work, but I don't know why - as far as I can tell I have the docs for `base` and the other packages installed with the global GHC. I installed GHC and stack together using MinGHC 2015-08-13 64-bit. Any idea why this would cause this problem? – Aaron Rotenberg Sep 05 '15 at 20:35
  • No, I don't know off hand what would be causing it. I'll have a look at the MinGHC release. – Michael Snoyman Sep 06 '15 at 02:46
  • It looks like there's a problem with the MinGHC installer. In order to get more details, I'll need to ask more questions than the comment field here is amenable to. Can you open up an issue of MinGHC's Github issue tracker? – Michael Snoyman Sep 06 '15 at 03:54
  • 2
    This is a pretty old thread but I ran into this same thing. The fix is to install the ghc-doc package (available in most package managers). – m-renaud Apr 24 '16 at 00:26
  • @mrenaud thank you! it is very difficult to conclude this from error report. – Yuri Syro Jul 27 '16 at 10:32
2

I solved this by installing the ghc-doc package (available in most package managers).

m-renaud
  • 1,275
  • 8
  • 11