
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.