Build managers like cabal-install and stack need access to installed toolchains managed by
installation managers like stack and ghcup. hs keeps track of the toolchains installed by
the managers and locates them on request for the build managers.
$ hs whereis ghc-8.10.4
/Users/chris/.stack/programs/x86_64-osx/ghc-8.10.4We have a prototype integration for stack (watch this space) and a collection of wrappers for
each tool that cabal-install can use, like the following for ghc-pkg-8.10.4:
#!/usr/bin/env bash
hs run ghc-pkg-8.10.4 --ask-install -- "$@"Used in this way, hs will try to locate ghc-pkg-8.10.4, asking the user if to proceed with an
installation with the preferred installation manager (stack or ghcup) if it cannot locate the
installation.
To list the installation in your development environment try this:
$ stack list
8.6.5 stack /Users/chris/.stack/programs/x86_64-osx/ghc-8.6.5
8.8.3 stack /Users/chris/.stack/programs/x86_64-osx/ghc-8.8.3
8.8.4 stack /Users/chris/.stack/programs/x86_64-osx/ghc-8.8.4
8.10.4 stack /Users/chris/.stack/programs/x86_64-osx/ghc-8.10.4
8.10.5 ghcup /Users/chris/.ghcup/ghc/8.10.5
9.0.1 ghcup /Users/chris/.ghcup/ghc/9.0.1
To configure the defaults you can do these.
# ghcup to carry out installations requested from the build tools
$ hs use ghcup stack
# ask before installing any missing toolchains
$ hs use-install-mode ask-install
# specify the deafult toolchain when no version specified
$ hs use-compiler 8.10.4To dump a new set of wrappers into ~/.hs/bin with your preferred ask-install installation
option:
$ hs dump-ghc-wrappers ask-installWith the path set up right your stack and cabal-install projects should play nicely together.
Share and Enjoy!
-
Build and install
hson your path. -
Build and install this patched version of
stack-2.8.0and put it on the path. -
Put these wrapper scripts on your path.