Skip to content

How to use stack with newer cabal version for older GHC? #4488

Closed
@vrom911

Description

@vrom911

Problem

As far as I see Stack LTS not only determine the version of GHC, but also restricted to use only the specific Cabal version that is stuck with the particular GHC. This creates some problems with using a unique version of Cabal for different versions of GHCs, for example, using common stanzas in cabal file with cabal: 2.4 and support both GHC-8.6.3 and GHC-8.4.4.

Stack also doesn't allow and deprecates now options: --install-cabal and --upgrade-cabal.

The question is: how is it possible to use a newer version of Cabal (eg. 2.4) for the old GHCs (e.g. 8.0.2)?

Example

I've created a test project to illustrate the problem clearer. It can be found here:

I want to support GHC versions:

  • 8.0.2
  • 8.2.2
  • 8.4.4
  • 8.6.3

To assure that everything works at all versions both with Stack and Cabal I've created this Travis file:

where I explicitly specify - cabal: 2.0.

Though it's ignored, so I also added this if statement (which is apparently doesn't work either):

https://github.com/vrom911/summon-test/blob/6ac63c3ad672d24b6f61589cdd163d33a5e2d64a/.travis.yml#L42-L44

And here is the output of failing Travis job for GHC-8.0.2 can be found here:

Stack version

Version 1.9.3, Git revision 40cf7b37526b86d1676da82167ea8758a854953b (6211 commits) x86_64 hpack-0.31.1

Method of installation

curl -sSL https://get.haskellstack.org/ | sh

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions