Last active
May 17, 2019 18:44
-
-
Save dehli/bc7bda2cf0722d53737f to your computer and use it in GitHub Desktop.
A bash script that allows you to execute Haskell files more easily.
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/bash | |
# A script that automatically compiles and runs Haskell files | |
# First paramter is the Haskell file | |
# Temporary file location | |
temp=~/../../tmp | |
# Compile Haskell file | |
ghc -o $temp/Main -outputdir $temp $1 | |
# Run the file | |
$temp/Main | |
# Cleanup | |
if [ $? -eq 0 ]; then | |
rm $temp/Main.hi | |
rm $temp/Main.o | |
rm $temp/Main | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Move this file to your
/bin/
directory by callingsudo mv haskell ~/../../bin
Then you can run Haskell files by calling:
haskell myHaskellFile.hs