ihatetoregister ihatetoregister - 3 months ago 44
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?



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!"