$ runhaskell MyFile.hs
Alternatively, runghc
(they're the same thing).
(或者,运行runghc
(它们是同一回事)。)
ghci MyFile.hs
will also start an interactive REPL session with MyFile.hs
loaded, but if you want to run a main program then runhaskell
is the way to go. (ghci MyFile.hs
也将启动一个交互式会话REPL MyFile.hs
加载,但如果你想运行主程序,然后runhaskell
是要走的路。)
It's probably a good idea to get into the habit of testing parts of your program as isolated units in GHCi rather than running the whole thing each time, but obviously for shorter scripts it's simplest and easiest just to run the entire thing.
(养成在GHCi中将程序的各个部分作为隔离单元进行测试的习惯,而不是每次都运行整个程序,这可能是一个好主意,但是显然,对于较短的脚本,仅运行整个程序是最简单,最容易的。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…