Suppose some Haskell file is executed with
runghc Queens.hs gecode_compile
Now, this fails, and I want to debug it with ghci
. How
You can use the System.Environment.withArgs function to execute main
with your desired arguments.
Here's an example session (irrelevant details elided):
$ ghci
GHCi, version 7.0.3: http://www.haskell.org/ghc/ :? for help
Prelude> import System.Environment
Prelude System.Environment> let main = getArgs >>= mapM_ putStrLn
Prelude System.Environment> withArgs ["hello", "world"] main
hello
world