[Haskell-cafe] PSA for Cabal 2.2 new-* users regarding .ghc.environment files

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Mon May 14 19:50:11 UTC 2018


Bryan Richter wrote:
> I use nix-shell for choosing specific ghc environments, and
> undoubtedly a theoretical 'cabal shell' could work similarly. (In
> fact, Nix could probably produce a saner (shell) environment by using
> GHC environments, so the two solutions could converge.)
>
> Consider the following hypothetical session:
> 
> $ cabal new-build
>   # Creates .cabal.ghc.environment.arch-os-version, which is
>   # non-default
> 
> $ cabal shell
>   # sets GHC_ENVIRONMENT to
>   # $PWD/.cabal.ghc.environment.arch-os-version and spawns shell
[...]
> $ cabal shell --run 'ghc-pkg list'
>   ... (same output as previous)

Note that cabal-install already provides a 'cabal exec' command which
offers essentially that functionality for sandboxes, though in a
different bikeshed color:

  $ cabal exec -- $SHELL

  $ cabal exec -- ghc-pkg list

Cheers,

Bertram


More information about the Haskell-Cafe mailing list