scripts on unix

Frederik Eaton frederik at a5.repetae.net
Wed Mar 14 15:31:55 EDT 2007


Hello,

What is the proper technique for creating a Haskell script on a Unix
system?

e.g. with Perl I do

#!/usr/bin/env perl
print "hello world\n";

or

#!/usr/bin/perl
print "hello world\n";

I tried

$ cat test
#!/usr/bin/env runhaskell
module Main where
main = do
    putStrLn "hello world"

But that doesn't work:

$ ./test
Warning: ignoring unrecognised input `./test'

<interactive>:1:73:
    Failed to load interface for `Main':
      Use -v to see a list of the files searched for.

When I use "runghc" I get the same error.

If I change the first line to "-x hs" then the error is:

ghc-6.6: unrecognised flags: -x hs
Usage: For basic information, try the `--help' option.

because the #! mechanism only allows a single argument. Thoughts?

Thanks,

Frederik

-- 
http://ofb.net/~frederik/


More information about the Glasgow-haskell-users mailing list