2
votes

I have no idea about haskell and am trying to setup stack(static)2.1.3-3 to work with the atom-haskell package in Atom 1.45 on linux, but it is not working.

The installation of atom-haskell created 2 error messages: -Failed to activate the ide-haskell package, Results already connected! The error was thrown from the ide-haskell-package. The issue has already been reported. (github.com/atom-haskell/ide-haskell/issues/138) -Atom couldn't find ghcmod executable

So I looked at https://atom.io/packages/atom-haskell and learnt that to set up the binaries I have to use

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

But that is not working:

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

In the dependencies for cabal-install-3.0.0.0:
    base-4.13.0.0 from stack configuration does not match >=4.8 && <4.13  (latest matching version is 4.12.0.0)
    hackage-security must match >=0.5.2.2 && <0.6, but the stack configuration has no specified version  (latest matching version is
0.5.3.0) needed since cabal-install is a build target.

In the dependencies for ghc-mod-5.8.0.0:
    Cabal-3.0.1.0 from stack configuration does not match >=1.18 && <1.25  (latest matching version is 1.24.2.0)
    base-4.13.0.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)
    djinn-ghc must match <0.1 && >=0.0.2.2, but the stack configuration has no specified version  (latest matching version is
0.0.2.3)
    extra-1.6.20 from stack configuration does not match <1.6 && >=1.4  (latest matching version is 1.5.3)
    fclabels must match ==2.0.*, but the stack configuration has no specified version  (latest matching version is 2.0.4)
    ghc-8.8.2 from stack configuration does not match >=7.6 && <8.2 
    ghc-syb-utils must match <0.3 && >=0.2.3, but the stack configuration has no specified version  (latest matching version is
0.2.3.3)
    haskell-src-exts-1.22.0 from stack configuration does not match <1.20 && >=1.18  (latest matching version is 1.19.1)
    hlint-2.2.11 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.15.1.0 from stack configuration does not match >=0.13.0.0 && <0.14  (latest matching version is 0.13.2.0)
    semigroups-0.19.1 from stack configuration does not match >=0.10.0 && <0.19  (latest matching version is 0.18.5)
    temporary-1.3 from stack configuration does not match <1.3 && >=1.2.0.3  (latest matching version is 1.2.1.1) needed since ghc-mod is a build target.

In the dependencies for hasktags-0.71.2:
    json must match >=0.5 && <0.11, but the stack configuration has no specified version  (latest matching version is 0.10) needed since hasktags is a build target.

In the dependencies for pointfree-1.1.1.6:
    base-4.13.0.0 from stack configuration does not match >=4.5 && <4.13  (latest matching version is 4.12.0.0)
    haskell-src-exts-1.22.0 from stack configuration does not match ==1.20.*  (latest matching version is 1.20.3) needed since pointfree is a build target.

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

The ghcmod problem is solved by the "warning" on https://atom-haskell.github.io/core-packages/haskell-ghc-mod/#using-with-stack : setting resolver version in ~/.stack/global-project/stack.yaml to lts-9.21 (it says "lts-9" - would that be more correct?). There are more instructions on that site, but I do not understand them.

Now there is a new error:

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

In the dependencies for pointfree-1.1.1.6:
    haskell-src-exts-1.18.2 from stack configuration does not match ==1.20.*  (latest matching version is 1.20.3)
needed since pointfree is a build target.
Some different approaches to resolving this:

  * Set 'allow-newer: true' in /home/bradz/.stack/config.yaml to ignore all version constraints and build anyway.

  * Recommended action: try adding the following to your extra-deps in /home/bradz/.stack/global-project/stack.yaml:

- haskell-src-exts-1.20.3@sha256:83ae523bbec907a42c043de1f5bbf4c1554e7c3b898af07bb1ce6e80eaa282ec,4589

Plan construction failed.

So I followed the recommendation and added it to my stack.yaml, that now looks like this:

packages: []
resolver: lts-9.21
extra-deps:
- haskell-src-exts-1.20.3@sha256:83ae523bbec907a42c043de1f5bbf4c1554e7c3b898af07bb1ce6e80eaa282ec,4589

But that seems to be wrong somehow, because now I am getting the ghcmod error again, and even more:

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

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

In the dependencies for ghc-mod-5.8.0.0:
    haskell-src-exts-1.20.3 from stack configuration does not match <1.20 && >=1.18  (latest matching version is 1.19.1)
needed since ghc-mod is a build target.

In the dependencies for haskell-src-exts-simple-1.19.0.0:
    haskell-src-exts-1.20.3 from stack configuration does not match >=1.18 && <1.20  (latest matching version is 1.19.1)
needed due to pointful-1.0.9 -> haskell-src-exts-simple-1.19.0.0

In the dependencies for hlint-2.0.11:
    haskell-src-exts-1.20.3 from stack configuration does not match >=1.18 && <1.20  (latest matching version is 1.19.1)
needed due to ghc-mod-5.8.0.0 -> hlint-2.0.11

In the dependencies for hoogle-5.0.14:
    haskell-src-exts-1.20.3 from stack configuration does not match >=1.18 && <1.20  (latest matching version is 1.19.1)
needed since hoogle is a build target.

Some different approaches to resolving this:

  * Set 'allow-newer: true' in /home/bradz/.stack/config.yaml to ignore all version constraints and build anyway.

  * Recommended action: try adding the following to your extra-deps in /home/bradz/.stack/global-project/stack.yaml:

- haskell-src-exts-1.19.1@sha256:30176fc34fb3a4eba0a7c31e50a2b09c70aab422e784de9f6b437eabe7de1288,4235

Plan construction failed.

edit: setting 'allow-newer: true' in /home/bradz/.stack/config.yaml and then executing stack install pointfree, does also not work:

WARNING: Ignoring pointfree's bounds on haskell-src-exts (==1.20.*); using haskell-src-exts-1.18.2.
Reason: allow-newer enabled.

(...) (~300 lines omitted)

haskell-src-exts> Registering haskell-src-exts-1.18.2...
pointfree       > configure   
pointfree       > Configuring pointfree-1.1.1.6...
pointfree       > build
pointfree       > Building pointfree-1.1.1.6...
pointfree       > Preprocessing library pointfree-1.1.1.6...
pointfree       > [1 of 7] Compiling Plugin.Pl.Common ( Plugin/Pl/Common.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-1.24.2.0/build/Plugin/Pl/Common.o )
pointfree       > [2 of 7] Compiling Plugin.Pl.Parser ( Plugin/Pl/Parser.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-1.24.2.0/build/Plugin/Pl/Parser.o )
pointfree       >      
pointfree       > /tmp/stack2192/pointfree-1.1.1.6/Plugin/Pl/Parser.hs:25:3: error:
pointfree       >     • Couldn't match expected type ‘HSE.SpecialCon a’
pointfree       >                   with actual type ‘HSE.Exp t0’
pointfree       >     • In the pattern: HSE.ExprHole {}
pointfree       >       In a case alternative: HSE.ExprHole {} -> todo sc
pointfree       >       In the expression:
pointfree       >         case sc of {
pointfree       >           HSE.UnitCon _ -> (Pref, "()")
pointfree       >           HSE.ListCon _ -> (Pref, "[]")
pointfree       >           HSE.FunCon _ -> (Inf, "->")
pointfree       >           HSE.TupleCon _ HSE.Boxed n -> (Inf, replicate (n - 1) ',')
pointfree       >           HSE.TupleCon {} -> todo sc
pointfree       >           HSE.Cons _ -> (Inf, ":")
pointfree       >           HSE.UnboxedSingleCon {} -> todo sc
pointfree       >           HSE.ExprHole {} -> todo sc }
pointfree       >     • Relevant bindings include
pointfree       >         sc :: HSE.SpecialCon a (bound at Plugin/Pl/Parser.hs:17:28)
pointfree       >         qnameString :: HSE.QName a -> (Fixity, String)
pointfree       >           (bound at Plugin/Pl/Parser.hs:15:1)
Completed 9 action(s). 

--  While building package pointfree-1.1.1.6 using:
      /home/bradz/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-1.24.2.0 build --ghc-options ""
    Process exited with code: ExitFailure 1

Please tell me how to solve this.

1
Have you tried the communication channels listed at atom-haskell.github.io? - sjakobi
No since I think this is a stack problem, so the atom package has not much to do with it apart from setting the requirements. - Bradzzv
Fair enough. Finding a single set of dependencies that works for all these packages is tricky though. Try installing them one by one. Also, for installing executables, using cabal is usually easier than stack since it has a proper dependency solver. - sjakobi
Try not to install all packages at the same time with the same resolver. It seems all but pointfree complains to lts-9.21 so try to install pointfree separatelly either by stack install pointfree (by temporarily using the allow-newer:true or extra-deps : ...) or by cabal install pointfree. - Redu
allow-newer:true + stack install pointfree does just result in another error (see edit). I don't want to use cabal because I assume that it would add even more complications. For me it has already become impossible to know what future errors I will encounter because of the lts-9.21 and allow-newer changes. If it is impossible to solve this cleanly, it should be communicated that atom-haskell+stack it is not working imho. - Bradzzv

1 Answers

2
votes

If trying to set up the binaries for the atom-haskell package (or applicable dependencies), I was able to successfully install the dependencies by using different long term support stack versions. For ghc-mod, hoogle, pointful, and cabal-install I used lts-9.21 and for hasktags, pointfree, and brittany I used lts-11.22 =>

stack --resolver lts-9.21 install ghc-mod hoogle pointful cabal-install

and

stack --resolver lts-11.22 install hasktags pointfree brittany

I hope this helps.