Run Haskell source files as shell scripts
To run a Haskell source file as a shell script, add one of the following blocks to the top of your source file:
With runhaskell
: 1
#!/usr/bin/env runhaskell
With cabal
: 1
#!/usr/bin/env cabal
{- cabal:
build-depends: base
-}
With stack
: 2
#!/usr/bin/env stack
-- stack script
Then, mark the script as executable: chmod u+x example.hs