[Haskell-cafe] scripting in haskell

mvanier mvanier at cs.caltech.edu
Wed Jul 26 01:27:48 EDT 2006


Lemmih wrote:
> On 7/25/06, mvanier <mvanier at cs.caltech.edu> wrote:
>> Hi,
>>
>> I was playing around with runhaskell (runghc to be precise), and I 
>> discovered
>> the limitation wherein you have to use the file suffix ".hs".  Don't 
>> get me
>> wrong, runhaskell is great, but if you didn't have that restriction it 
>> would
>> make haskell much more attractive to many programmers who write 
>> standalone scripts.
>>
>> Of course it's always possible to do e.g.
>>
>> (file: hello)
>> #! /bin/sh
>> runhaskell Hello.hs
>>
>> (file: Hello.hs)
>> module Main where
>> main :: IO ()
>> main = putStrLn "hello, world!"
>>
>> but that's pretty inconvenient.  What I'd like is:
>>
>> (file: hello)
>> #! /usr/bin/env runhaskell
>> module Main where
>> main :: IO ()
>> main = putStrLn "hello, world!"
>>
>> which is _almost_ doable; you have to name the file "hello.hs".  What 
>> would
>> really be optimal is something like
>>
>> (file: hello)
>> #! /usr/bin/env runhaskell
>> -fglasgow-exts  -- extra arguments to runhaskell
>> !#
>>
>> module Main where
>> main :: IO ()
>> main = putStrLn "hello, world!"
>>
>> Looking through the mailing list I see something from May 2005 on this 
>> topic
>> about adding the equivalent of gcc's "-x" option to ghc.  What's the 
>> status of that?
> 
> This is already implemented and will be in GHC-6.6 when it's released.
> 

Awesome!  Thanks.

Mike



More information about the Haskell-Cafe mailing list