[Haskell-cafe] scripting in haskell

Marc Weber marco-oweber at gmx.de
Tue Jul 25 18:52:58 EDT 2006


> 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?

You should always be able to do something like this:
#!/usr/bin/runfileAsHSFile "$@"
module Main where
import 
blah

---- runfileAsHSFile ----
#!/bin/sh
# run a file by creating a virtual hs file (fifo file pipe)
fileToRun=$1; shift;
f=tempfile -s .hs
mkfifo $f
sed -e '1d' $fileToRun > $f & # remove the first shabeng line using
sed..
runhaskell $f
rm $f

This is written from scratch but should work without much changes..

But there might be much better solutions.

Marc Weber


More information about the Haskell-Cafe mailing list