
On Wednesday 17 November 2004 15:06, Nils Anders Danielsson wrote:
On Wed, 17 Nov 2004, Benjamin Franksen wrote:
I want to use ghc as a script interpreter, using the '-e' option. The problem is that I can't give the script any command line arguments, because 'ghc -e' intepretes everything argument as the name of a module to compile.
I once wrote a script which circumvented the issue above by using System.Environment.withArgs. It works, but it is of course a little clunky.
See the attached sources.
Thanks a lot! I needed to modify it a little to suit my preferences but it works like a charm. BTW, it seems as if ghc already ignores a first line starting with "#!", which makes the program a bit simpler. What about putting this thing on the Haskell Wiki? Cheers, Ben PS: Sorry for the delayed answer.