Tehnix / atom-haskell

Curated set of Haskell packages for Atom
https://atom.io/packages/atom-haskell
MIT License
8 stars 3 forks source link

Impossible to install ghc-mod #4

Closed JulienPerrin closed 4 years ago

JulienPerrin commented 6 years ago

When I entered this line in my terminal as indicated in the ReadMe :

stack install ghc-mod hoogle hasktags pointfree pointful cabal-install

I received this error :

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

In the dependencies for ghc-mod-5.8.0.0: Cabal-2.0.1.1 from stack configuration does not match >=1.18 && <1.25 (latest matching version is 1.24.2.0) base-4.10.1.0 from stack configuration does not match >=4.6.0.1 && <4.10 (latest matching version is 4.9.1.0) cabal-helper must match <0.8 && >=0.7.3.0, but the stack configuration has no specified version (latest matching version is 0.7.3.0) extra-1.6.8 from stack configuration does not match <1.6 && >=1.4 (latest matching version is 1.5.3) ghc-8.2.2 from stack configuration does not match >=7.6 && <8.2 haskell-src-exts-1.20.2 from stack configuration does not match <1.20 && >=1.18 (latest matching version is 1.19.1) hlint-2.1.6 from stack configuration does not match <2.1 && >=2.0.8 (latest matching version is 2.0.15) monad-journal-0.8.1 from stack configuration does not match <0.8 && >=0.4 (latest matching version is 0.7.2) optparse-applicative-0.14.2.0 from stack configuration does not match >=0.13.0.0 && <0.14 (latest matching version is 0.13.2.0) needed since ghc-mod is a build target.

In the dependencies for pointfree-1.1.1.3: base-4.10.1.0 from stack configuration does not match >=4.5 && <4.10 (latest matching version is 4.9.1.0) haskell-src-exts-1.20.2 from stack configuration does not match >=1.18 && <1.20 (latest matching version is 1.19.1) needed since pointfree is a build target.

In the dependencies for pointful-1.0.11.0: haskell-src-exts-simple must match >=1.18 && <1.20 || ^>=1.20, but the stack configuration has no specified version (latest matching version is 1.20.0.0) needed since pointful is a build target.

Some different approaches to resolving this:

  • Consider trying 'stack solver', which uses the cabal-install solver to attempt to find some working build configuration. This can be convenient when dealing with many complicated constraint errors, but results may be unpredictable.

  • Recommended action: try adding the following to your extra-deps in C:\sr\global-project\stack.yaml:

  • Cabal-1.24.2.0
  • base-4.9.1.0
  • cabal-helper-0.7.3.0
  • extra-1.5.3
  • haskell-src-exts-1.19.1
  • haskell-src-exts-simple-1.20.0.0
  • hlint-2.0.15
  • monad-journal-0.7.2
  • optparse-applicative-0.13.2.0

Plan construction failed.

I found that the reason is that I had to put an older version of the resolver lts in stack.yaml : resolver: lts-9.9

Maybe you should add it in your readme. It is also mentioned in here : https://atom-haskell.github.io/core-packages/haskell-ghc-mod/#maintain-a-separate-ghc-mod-installation-for-each-stack-resolver

Later stack versions (and resolvers) install packages per-resolver globally, regardless of if you run stack build ghc-mod in stack project directory or not. Not sure which version changed that, but stack 1.0.2 with lts-5.6 resolver does that.

colbyn commented 6 years ago

To my understanding atom-haskell is just a bundle of the following packages, language-haskell ide-haskell ide-haskell-cabal haskell-ghc-mod autocomplete-haskell. If it helps, the relevant documentation is here: https://atom-haskell.github.io/installation/installing-binary-dependencies/

colbyn commented 6 years ago

If you’re trying to get ghc-mod working with ghc 8.3, my advice would be to use the version of ghc-mod bundled with haskell-ide-engine. https://github.com/haskell/haskell-ide-engine

Tehnix commented 6 years ago

Indeed, this is just a bundle of packages to get quickly started.

Another way to keep ghc-mods per GHC is to use stack build --copy-compiler-tool ghc-mod with your resolver. This will not put the ghc-mod in your global bin, but put it in a compiler specific bin. Meaning stack exec ghc-mod in a project using GHC 8.2.2 will find the one built for 8.2.2 and stack exec ghc-mod in a project for 8.0.2 will find that one.

Of course, you'll have to build it for the GHC version the first time you use it, or just find a build them immediately with fitting resolvers.

andrewufrank commented 4 years ago

It seems possible to install ghc-mod with

stack --resolver lts-9.21 install ghc-mod

Tehnix commented 4 years ago

Going with an explicit resolver is probably the best way forward.

I'll close this issue to do a little housekeeping. Also, the Haskell IDE landscape has changed significantly since this, and I would recommend people check out ghcide (or HIE) instead of using ghc-mod :)