
As an Haskell beginner, and considering this may be compiler dependent, I shall ask it on this list. How can I access command line arguments from my main function in my Main module? Cheers, -- Paulo Jorge Matos - pocm at soton.ac.uk http://www.personal.soton.ac.uk/pocm PhD Student @ ECS University of Southampton, UK

Hi
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. Thanks Neil

On 18/10/2007, Neil Mitchell
Hi
As an Haskell beginner, and considering this may be compiler dependent, I shall ask it on this list.
It's standard across all implementations.
So that's part of the Haskell98 standard? Nice! So, is it usual for compilers to implement extensions to the standard? If yes, where can I find the documentation for GHC extensions?
How can I access command line arguments from my wmain function in my Main module?
import System.Environment
main = do args <- getArgs print args
Thank you!
You can also do in GHCi and Hugs:
:main test arguments
To test your code with argument values.
Thanks
Neil
-- Paulo Jorge Matos - pocm at soton.ac.uk http://www.personal.soton.ac.uk/pocm PhD Student @ ECS University of Southampton, UK

Hi
So that's part of the Haskell98 standard?
In the Haskell98 standard it can be imported from System, rather than System.Environment. Nowadays all compilers can use either.
Nice! So, is it usual for compilers to implement extensions to the standard? If yes, where can I find the documentation for GHC extensions?
Different compilers have different extensions. Yhc has very few, Hugs has a couple, GHC has loads. They are documented in the GHC manual. Thanks Neil
participants (2)
-
Neil Mitchell
-
Paulo J. Matos