[Haskell-cafe] downgrading GHC version on a Mac
Liam Wall
liam.wall+haskell at gmail.com
Fri Apr 6 08:48:40 UTC 2018
Hi, I'm not Matt, but maybe can help anyway...
`stack exec zsh` just runs zsh with some modified environment
variables. In particular, it'll change PATH so that ghc, gchi,
runhaskell etc all resolve to a stack local installation, not the
system installation.
You can can substitute bash or whatever shell you use for zsh. There's
also a command line option for selecting the resolver. E.g. this
example is copied directly form my terminal:
[~]% which ghc
/usr/bin/ghc
[~]% ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.2.2
[~]% stack exec --resolver lts-6.25 --no-ghc-package-path zsh
[~]% which ghc
/home/liam/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-7.10.3/bin/ghc
[~]% ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.3
[~]% exit
[~]% ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.2.2
My system installation has ghc 8.2.2. After running `stack exec` with
resolver lts-6.25, invoking ghc is 7.10.3. After exiting that shell
it's back to the system installed version.
The stackage homepage lists which resolver to use to get a given ghc
version: https://www.stackage.org/
Caveat: I'm a haskell newbie, and I've not used ghcjs ever, so I'm not
really sure if this will work for you. I guess the suggested approach
is to run `stack exec ...` to get the appropriate ghc version you
need, then proceed with whatever you need to do for ghcjs. I think the
suggested --no-ghc-package-path flag is to ensure cabal works
properly. I *think* `stack exec` sets up the environment so that any
packages installed with cabal go into a sandbox for the version of ghc
you're using.
Since you already have stack installed, it seems easier to try this
approach before modifying you system installation.
Also, there is this which might be easier:
https://docs.haskellstack.org/en/stable/ghcjs/
Hope that helps,
Liam
On 5 April 2018 at 20:41, Dennis Raddle <dennis.raddle at gmail.com> wrote:
> Sorry, I don't follow what you're saying. What does 'stack-shell' do? How do
> I make or choose a resolver?
>
> And is this going to work with GHCJS? Seems simpler to go along with what
> GHCJS expects, as there may be a number of auxiliary programs to GHCJS that
> expect the same thing.
>
> D
>
>
> On Thu, Apr 5, 2018 at 11:13 AM, Matt <parsonsmatt at gmail.com> wrote:
>>
>> I do not have a system GHC installed. For tools that need it (eg cabal), I
>> have an alias `stack-shell` that does `stack exec --no-ghc-package-path
>> zsh`. You can use that, with a given resolver (that corresponds to the GHC
>> version you want) to have a shell open with the GHC you want to use
>> available "globally." I find that this keeps things clean and easy to
>> understand.
>>
>> Matt Parsons
>>
>> On Thu, Apr 5, 2018 at 12:06 PM, Dennis Raddle <dennis.raddle at gmail.com>
>> wrote:
>>>
>>> I'm on a MacBook Pro. I'm not very familiar with software installation.
>>>
>>> Up until now I've been using Stack for GHC work, and it seems to take
>>> care of having the right version of GHC.
>>>
>>> Now I'm going to use GHCJS, and I need to have a system GHC installed (I
>>> believe). At some point in the past I installed the Haskell Platform for
>>> Mac, and I have GHC 8.01. But I want to downgrade that to 7.10 so that I
>>> don't have to worry about compatibility with GHCJS.
>>>
>>> How do I go about uninstalling GHC 8 and installing 7.10 in its place?
>>> Can I use Homebrew?
>>>
>>> D
>>>
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> To (un)subscribe, modify options or view archives go to:
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>> Only members subscribed via the mailman list are allowed to post.
>>
>>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
More information about the Haskell-Cafe
mailing list