1

I am trying to use grenade in Haskell. Using stack as a configuration tool, I have

# stack.yaml

extra-deps:
- diagrams-solve-0.1.1
- dual-tree-0.2.2
- SVGFonts-1.6.0.3
- diagrams-core-1.4.1
- diagrams-lib-1.4.2.2
- diagrams-postscript-1.4.1
- diagrams-svg-1.4.2
- Chart-diagrams-1.8.3
- hip-1.5.3.0
- singletons-2.2
- template-haskell-2.11.1.0
- th-desugar-1.6
- grenade-0.1.0

But when I execute stack build, it gives me the following error

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

In the dependencies for th-desugar-1.6:
    template-haskell-2.12.0.0 from stack configuration does not match <2.12  (latest
                              matching version is 2.11.1.0)
needed due to Brain-0.1.0.0 -> th-desugar-1.6

Some different approaches to resolving this:

  * Set 'allow-newer: true' to ignore all version constraints and build anyway.

  * 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 [Project directory]/stack.yaml:

- template-haskell-2.11.1.0

Plan construction failed.

Even if I put - template-haskell-2.11.1.0 before diagrams-solve, stack still gives me the same error. Allowing newer versions is not viable since it breaks th-desugar.

Henricus V.
  • 898
  • 1
  • 8
  • 29
  • 1
    You cannot specify `template-haskell` in extra-deps. It comes shipped with GHC (along with packages like base etc) – Sibi Jun 16 '18 at 14:42
  • @Sibi Then how can I tell stack to use the corresponding ghc version? – Henricus V. Jun 16 '18 at 14:43
  • 1
    Your resolver controls the ghc version. You can get the proper one from the home page: https://www.stackage.org/ – Sibi Jun 16 '18 at 14:48

1 Answers1

4

That looks like a lot of extra-deps. I'd recommend figuring out a good resolver first. The best way to do that is use the original repo:

git clone git@github.com:HuwCampbell/grenade.git
cd grenade
stack init

Which gives you the following output:

Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- ./
- examples/

Selecting the best among 13 snapshots...

* Partially matches lts-11.13
    criterion version 1.3.0.0 found
        - grenade requires ==1.1.*

Downloaded nightly-2018-06-16 build plan.    
* Partially matches nightly-2018-06-16
    criterion version 1.4.1.0 found
        - grenade requires ==1.1.*
    hmatrix version 0.19.0.0 found
        - grenade requires ==0.18.*
        - grenade-examples requires ==0.18.*
    singletons version 2.4.1 found
        - grenade requires >=2.1 && <2.4

* Partially matches lts-10.10
    criterion version 1.2.6.0 found
        - grenade requires ==1.1.*

Downloaded lts-9.21 build plan.    
* Matches lts-9.21

Selected resolver: lts-9.21
Initialising configuration using resolver: lts-9.21
Total number of user packages considered: 2
Writing configuration to file: stack.yaml
All done.

So use the base resolver lts-9.21. And I'd open an issue on the repo of grenade to add it to stack.

Reactormonk
  • 21,472
  • 14
  • 74
  • 123