Bash script for running some quick haskell on the command line
USAGE: hk [OPTIONS] [CODE]
hk facilitates running some quick haskell at your shell prompt
The type of CODE can be an IO type or anything for which there is a Show instance. If unsure, try something and then just run hk -e to see the actual program in vim or the editor indicated by the EDITOR environment variable. Remember to observe the quoting rules of your shell; for example, in bash, you probably want to enclose CODE in single quotes.
-e Edit the last script and then run it in current directory
-d Dump last script to stdout
-p CODE Pipe mode, apply CODE to contents of stdin
-x CODE Show result of CODE using xmessage
-h This help screen
Assuming Bash quoting rules:
$ hk sum [1..10]/5
11.0
$ hk 'readFile "Nums" >>= print . sum . map read . lines'
1123
$ cat Nums | hk -p 'sum . map read . lines'
1123
$ hk 'getArgs>>= print . sum . map read' 1000 100 20 3
1123
$ echo -e "ok\nthen\nsome" | hk 'liftM2 zip getArgs (fmap lines getContents)' arg1 arg2 arg3
[("arg1","ok"),("arg2","then"),("arg3","some")]