How to set a program's command line arguments for GHCi?

gatoatigrado picture gatoatigrado · Jan 15, 2012 · Viewed 9.1k times · Source

Suppose some Haskell file is executed with

runghc Queens.hs gecode_compile

Now, this fails, and I want to debug it with ghci. How do I pass the option gecode_compile into the program, so getArgs will read it correctly?

Thanks!!

Answer

Daniel Fischer picture Daniel Fischer · Jan 15, 2012

You can also set the command line arguments in ghci

ghci> :set args foo bar
ghci> main

or

ghci> :main foo bar