yujaiyu
yujaiyu

Reputation: 9003

Fail with basic usage of haskell stack

I'm learning Haskell and trying to setup my Emacs development environment (reading this).
One of things I should do is to install hindent.
Recommended method here is just stack install hindent. I guess it should be installed in stack's global-project space. My global stack yaml at $HOME/.stack/global-project/stack.yaml is:

flags: {}
extra-package-dbs: []
packages: []
extra-deps: []
resolver: ghc-7.10.3

I don't use any system ghc (there is no ghc or ghci on my $PATH).
On stack install hindent it adviced me to extend extra-deps:

Run from outside a project, using implicit global project config
Using resolver: ghc-7.10.3 from implicit global project's config file: /home/me/.stack/global-project/stack.yaml

While constructing the build plan, the following exceptions were encountered:

In the dependencies for hindent-5.2.1:
    descriptive must match >=0.7 && <0.10, but the stack configuration has no specified version
                (latest applicable is 0.9.4)
    exceptions must match -any, but the stack configuration has no specified version (latest applicable is 0.8.3)
    haskell-src-exts must match >=1.18, but the stack configuration has no specified version
                     (latest applicable is 1.18.2)
    monad-loops must match -any, but the stack configuration has no specified version (latest applicable is 0.4.3)
    mtl must match -any, but the stack configuration has no specified version (latest applicable is 2.2.1)
    path must match -any, but the stack configuration has no specified version (latest applicable is 0.5.9)
    path-io must match -any, but the stack configuration has no specified version (latest applicable is 1.2.0)
    text must match -any, but the stack configuration has no specified version (latest applicable is 1.2.2.1)
    unix-compat must match -any, but the stack configuration has no specified version (latest applicable is 0.4.2.0)
    utf8-string must match -any, but the stack configuration has no specified version (latest applicable is 1.0.1.1)
    yaml must match -any, but the stack configuration has no specified version (latest applicable is 0.8.20)

Recommended action: try adding the following to your extra-deps in /home/me/.stack/global-project/stack.yaml:
- descriptive-0.9.4
- exceptions-0.8.3
- haskell-src-exts-1.18.2
- monad-loops-0.4.3
- mtl-2.2.1
- path-0.5.9
- path-io-1.2.0
- text-1.2.2.1
- unix-compat-0.4.2.0
- utf8-string-1.0.1.1
- yaml-0.8.20

When I do what is proposed it suggests some new dependencies (which are probably dependencies of those which are added before) etc. At the end it results in situatuation where some two dependencies have unmet versions.

I presume that something is wrong with my configuration (or understanding of stack) since I think that obtaining implicit dependencies is job of a build tool.

Does someone more experienced can infer what is my beginner fault?

Upvotes: 3

Views: 586

Answers (2)

user2913694
user2913694

Reputation:

Not sure. If you just wanna get moving fast:

stack upgrade --git  && \
rm -rf ~/.stack      && \
stack setup          && \
stack install hindent

Why not use GHC 8.X and a fresh new Stack? ;)

Upvotes: 0

Michael Snoyman
Michael Snoyman

Reputation: 31355

It's not generally recommended to use a ghc version as a resolver, for the reason you've discovered: you need to manually specify lots of package versions. Instead, I'd recommend switching to lts-6.23, or something else similar.

Upvotes: 4

Related Questions