ihatetoregister ihatetoregister - 1 year ago 106
Bash Question

Can Haskell be used to write shell scripts?

Is it possible to write shell scripts in Haskell and if so, how do you do it? Just changing the interpreter like so?


Answer Source

Using ghci will just load the module in GHCi. To run it as a script, use runhaskell or runghc:

#!/usr/bin/env runhaskell
main = putStrLn "Hello World!"