Randomize
Randomize

Reputation: 9103

Switching through different versions of GHC included 7.0.4

I need to compile some code starting from the GHC version 7.0.4 until the most recent 8.0.2. I know that using stack I can do something like:

stack init --resolver lts ...

on the local project but the lts versions don't go further than GHC 7.8.3.

How can I switch back to older version of GHC without using stack?

Upvotes: 1

Views: 118

Answers (2)

wizzup
wizzup

Reputation: 2411

Do you really need stack to build the project, i.e. stack.yaml and stack build?

If it is not the case and you just want multiple ghc versions, you might want to try

  1. nix, it have various ghc versions.

But keep in mind that older than 8.0.2 is not officially support but it might still working.

  1. docker, use it to setup any version you want

  2. travis, as previous answer suggested.

Upvotes: 0

Sibi
Sibi

Reputation: 48766

No, you cannot have stack use ghc 7.0.4 because it's not in their snapshot. The oldest compiler stack supports is 7.8.3.

Theoretically, stack can provide support for older compilers, but the Stackage server was announced at August, 2014 and GHC 7.0.4 was released on June, 2011. That's my educated guess of why 7.0.4 is not present.

If you want your code to have support for older compilers, I would recommend you to use a CI system like Travis. Another alternative if you are using a Ubuntu machine is to use Herber's PPA for installing the older compilers.

Upvotes: 1

Related Questions