Command Line Arguments

Neil Mitchell ndmitchell at
Thu Oct 18 13:07:58 EDT 2007


> As an Haskell beginner, and considering this may be compiler
> dependent, I shall ask it on this list.

It's standard across all implementations.

> How can I access command line arguments from my main function in my Main module?

import System.Environment

main = do
    args <- getArgs
    print args

You can also do in GHCi and Hugs:

:main test arguments

To test your code with argument values.



More information about the Glasgow-haskell-users mailing list