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

Bryan Richter b at chreekat.net
Mon May 14 19:39:23 UTC 2018


On 05/13/2018 05:39 AM, Brandon Allbery wrote:
> The whole point of them is to enable doing things that no tooling
> can sanely automate, enabling the environment from those builds to
> be available to do those things. Which is admittedly trying to do
> two incompatible things at once (propagate the build environment
> sometimes but not always, with no way to know which is intended); if
> you have a good answer for that one, I suspect many people would
> like to hear it.

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]$ ghc-pkg list
  ... (we see our customized environment)

[cabal]$ exit

$ cabal shell --run 'ghc-pkg list'
  ... (same output as previous)

$ cabal shell --environment /path/to/ghc.environment

[cabal]$ ghc-pkg list
  ... etc.

Basically, "cabal shell" would be a wrapper over
"GHC_ENVIRONMENT=/path $SHELL", but more friendly and with room for
expansion.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180514/a6e2c7f2/attachment.sig>


More information about the Haskell-Cafe mailing list