Create a gist now

Instantly share code, notes, and snippets.

Script to switch swap Cabal sandboxes for different versions of GHC.
# swith out a cabal sandbox for one version of a compiler for another.
#!/bin/bash
set -e
if [ -z "$2" ]; then
echo usage: $0 ghc-version-from ghc-version-to
exit 1
fi
CONFIG=cabal.sandbox.config
SANDBOX=.cabal-sandbox
FROMCONFIG=$CONFIG-$1
FROMSANDBOX=$SANDBOX-$1
TOCONFIG=$CONFIG-$2
TOSANDBOX=$SANDBOX-$2
if [ -e "$TOCONFIG" ]; then
if [ -d "$TOSANDBOX" ]; then
rm -rf dist
cp -r $SANDBOX $FROMSANDBOX
cp $CONFIG $FROMCONFIG
cp -r $TOSANDBOX $SANDBOX
cp $TOCONFIG $CONFIG
else
echo $TOSANDBOX
exit 1
fi
else
echo $TOCONFIG or $TOSANDBOX do not exist
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment