[Haskell-cafe] What is a good way to test library on several ghc's?
esz at posteo.de
Mon Mar 13 08:28:07 UTC 2017
> Someone asked to add support in my lib for older version of GHC.
> I know that there are GHC-version specific pragmas to activate the
> code on specific version.
> I'm not quite sure how to setup the environment to use several GHCs.
> How do you do that kind of thing?
You can do it quite easily with Nix (which you can use alongside your
normal package manager without interference, if you're not on NixOS).
Type in your package's root directory:
cabal2nix --shell > shell.nix
Then you can build your package with various compiler versions:
nix-build shell.nix --argstr compiler ghc803
nix-build shell.nix --argstr compiler ghc7103
nix-build shell.nix --argstr compiler ghcjs
If a build is successful, you will get a symlink called 'result', which
points to an installed version if your package including documentation.
Once you're done testing, just delete that link.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 487 bytes
Desc: not available
More information about the Haskell-Cafe