Skip to content

Instantly share code, notes, and snippets.

@UnkindPartition
Last active August 29, 2015 13:57
Show Gist options
  • Save UnkindPartition/9365969 to your computer and use it in GitHub Desktop.
Save UnkindPartition/9365969 to your computer and use it in GitHub Desktop.
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 "$@"; }
@daliborfilus
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment