By default, runhaskell seems to ignore shared sandbox paths.
When running a haskell file from the command line using runhaskell, how do I set the sandbox directory?
Sandboxes are a concept specific to Cabal, and runhaskell (and the rest of the GHC suite) has no idea about them. The relevant concept to GHC is the package database path, which can be controlled either by command-line flags like -package-db
or by the environment variable GHC_PACKAGE_PATH
. runhaskell
seems not to support -package-db
, so setting GHC_PACKAGE_PATH
is the best bet. Or of course you can let Cabal do the work with cabal exec
as Daniel Wagner pointed out in a comment.
cabal exec
works by setting GHC_PACKAGE_PATH
, so if for some reason you want to set the variable manually, you can see what value Cabal sets it to with the command cabal exec printenv GHC_PACKAGE_PATH
.