Accpeting command-line arguments in GHC/Hugs

Sengan [email protected]
Tue, 23 Jan 2001 14:27:08 -0500


Shlomi Fish wrote:
> 
> How can I read the command-line arguments passed to the program. For
> instance, if I run my compiled program by typing "./foo hello -o
> file.txt", I wish to access the list ["hello", "-o", "file.txt"] somehow.


> module Main (main) where 
> import System

> main      = getArgs >>= \args -> hugsMain args
> hugsMain :: [String] -> IO ()
> hugsMain = print

ghc Main.lhs
a.out foo bar --help
["foo","bar","--help"]


Sengan