Created
June 22, 2012 18:34
-
-
Save andy-morris/2974419 to your computer and use it in GitHub Desktop.
Wrapper for ghc with haskellmode & cabal-dev
This file contains 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
#!/usr/local/bin/zsh | |
if [[ -d ./cabal-dev ]]; then | |
ignoreflags=('-O.*' --make -debug -threaded -ticky '.*\.hs' -prof) | |
ignorere="/^(${(j'|')ignoreflags})\$/" | |
argflags=(-package-name -package-conf -odir -hidir -stubdir -package-id) | |
argre="/^(${(j'|')argflags})\$/" | |
output=`cabal-dev buildopts` || exit 1 | |
args=$(print $output | \ | |
sed '/End/q' | \ | |
sed '/^-o$/,/./d' | \ | |
sed -E "$argre { N; s/\\n/ /; }" | \ | |
sed -E '/^[^-]/d' | \ | |
sed -E "1d; \$d; ${ignorere}d;") | |
#print -- $args | |
ghc ${(f)args} $@ | |
else | |
ghc $@ | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment