Skip to content

Instantly share code, notes, and snippets.

@dehli
Last active May 17, 2019 18:44
Show Gist options
  • Save dehli/bc7bda2cf0722d53737f to your computer and use it in GitHub Desktop.
Save dehli/bc7bda2cf0722d53737f to your computer and use it in GitHub Desktop.
A bash script that allows you to execute Haskell files more easily.
#!/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
@dehli
Copy link
Author

dehli commented Jul 16, 2015

Move this file to your /bin/ directory by calling sudo mv haskell ~/../../bin

Then you can run Haskell files by calling:
haskell myHaskellFile.hs

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