Search code examples
haskellghci

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


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!!


Solution

  • You can also set the command line arguments in ghci

    ghci> :set args foo bar
    ghci> main
    

    or

    ghci> :main foo bar