Dave: > My apologies if this is a question with a trivial answer. > Command line args in C are accessed via argc and argv[] > defined as arguments to main();. > > How are command line arguments to a ghc-compiled program > accessed in Haskell? Or is that even possible?
Simplest: System.Environment:getArgs import System.Environment main = do args <- getArgs print args http://haskell.org/ghc/docs/latest/html/libraries/base/System-Environment.html Complex: System.Console.GetOpt Example here: http://cgi.cse.unsw.edu.au/~dons/blog/2006/12/18#ph-3 http://haskell.org/ghc/docs/latest/html/libraries/base/System-Console-GetOpt.html You can find these functions yourself with hoogle: http://haskell.org/hoogle/ Searching for 'args' returns: System. getArgs :: IO [String] Cheers, Don P.S. This question is best asked on #haskell possibly (http://haskell.org/haskellwiki/IRC_channel) _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe