Last active
August 29, 2015 13:57
-
-
Save UnkindPartition/9365969 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_db() { | |
if [ -z "$CABAL_SANDBOX_CONFIG" ] | |
then | |
db="" | |
else | |
db=$(sed -nr -e 's/^package-db: (.*)/\1/p' "$CABAL_SANDBOX_CONFIG") | |
if [ $? -ne 0 ]; then exit 1; fi | |
fi | |
} | |
db_cmd() ( | |
# on zsh, switch to the POSIX emulation mode | |
emulate sh 2>/dev/null | |
get_db | |
cmd=$1 | |
shift | |
command "$cmd" ${db:+-no-user-package-db -package-db "$db"} "$@" | |
) | |
ghc() { db_cmd ghc "$@"; } | |
ghci() { db_cmd ghci "$@"; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi. I came across your blog post: https://ro-che.info/articles/2014-03-05-cabal-sandbox-tips
And it needs to be updated. There is new command, "cabal repl" which does the same thing as "cabal-dev ghci" and/or your script. At least in this version of cabal (latest Haskell Platform):
$ cabal --version
cabal-install version 1.18.0.5
using version 1.18.1.4 of the Cabal library