using haskell as a shell language
Juan Carlos Arevalo-Baeza
jcab@roningames.com
Mon, 5 Nov 2001 17:32:34 -0800
On Tue, 6 Nov 2001 00:48:12 GMT, Hal Daume wrote:
>and whatnot. =A0i'd like to be able to write something like:
>
>#!/usr/local/ghc/bin/ghc
>main =3D do putStrLn "foo"
>
>
>
>and whatnot, even if I have to explicitely say something like:
>
>#!/usr/local/ghc/bin/ghc
>module Main(main) where
>main =3D do putStrLn "foo"
I guess you want to run ghci or hugs, not ghc.
You should be able to implement this easily. I'm not running=
UNIX/Linux here, so I can't test it, but this should work fine=
just by specifying the correct executable path. The only problem=
I'm aware of is that the first line (the #! line) might be=
included in the input piped into the program, which means that=
you'll have to run it through a filter. But that filter should=
be very easy to make using awk or something like that. You could=
even make it in Haskell, if you want, and you could make it=
prepend the "module" header, too, for convenience.
Salutaciones,
JCAB
email: jcab@roningames.com
ICQ: 101728263
The Rumblings are back: http://www.JCABs-Rumblings.com