-
-
Save sordina/a803b5536ab16c678b45 to your computer and use it in GitHub Desktop.
Evaluate Haskell Expression and allow for module imports.
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
#!/bin/sh | |
if [[ ! "$1" ]] | |
then | |
echo 'usage: ghcm <expression> <module>*' | |
exit 1 | |
fi | |
tmp_mod="/tmp/tmp_mod_$$.hs" | |
exp="$1" | |
shift | |
echo "$@" | xargs -n 1 echo import | sed 's/$/;/' > $tmp_mod | |
ghc -e "$exp" $tmp_mod | |
rm $tmp_mod |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way to do this using
ghc -e
on its own?