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

Bryan Richter b at chreekat.net
Mon May 14 20:14:31 UTC 2018


On 05/14/2018 03:50 PM, Bertram Felgenhauer via Haskell-Cafe wrote:
> 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
>

Heh, oops, I knew that. :) I have just been in the Nix swamps for
too long recently.

That said, this seems like the right solution. Rather than create
used-by-default GHC environments, Cabal should modify "exec" to
pick up a Cabal-generated environment.

-------------- 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/af36ad65/attachment.sig>


More information about the Haskell-Cafe mailing list