如何为GHCi设置程序的命令行参数? [英] How to set a program's command line arguments for GHCi?
本文介绍了如何为GHCi设置程序的命令行参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设某些Haskell文件是用
Suppose some Haskell file is executed with
runghc Queens.hs gecode_compile
现在,这失败了,我想用ghci
对其进行调试.如何将选项gecode_compile
传递到程序中,以便getArgs
可以正确读取它?
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?
谢谢!
推荐答案
您还可以在ghci中设置命令行参数
You can also set the command line arguments in ghci
ghci> :set args foo bar
ghci> main
或
ghci> :main foo bar
这篇关于如何为GHCi设置程序的命令行参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文