更新时间:2023-10-17 18:07:16
您需要一个 Main
模块(和一个 main
操作)来生成可执行文件。您可以将模块重命名为 Main
,也可以在命令行上将模块指定为 Main
,
You need a Main
module (and a main
action) to produce an executable. You can rename your module to Main
, or you can specify the module to be considered Main
on the command line,
ghc --make -main-is AddAllTests AddAllTests.hs -o testResults.exe
生成没有名为 Main
的模块的可执行文件。
to produce an executable without a module named Main
.
没有编译的方法将是
ghc AddAllTests.hs -e "main" > testResults.txt
另一种方法是拥有一个只列出所有测试用例的文件,
Another method would be to have a file in which you just list all test cases,
3 + 2 :: Rational
reverse "foobar"
:q
并运行 ghci
并重定向输入和输出
and run ghci
with redirected in- and output
ghci < testCases > testResults.txt