有没有办法,无论是标准的还是聪明的黑客,在文件上调用GHC只运行类型检查器?例如
$ ghc --just-check-the-types x.hs
$
Run Code Online (Sandbox Code Playgroud)
没有输出文件,没有.hi或.o等.不想/不能使用GHC API.这里只是谈论命令行程序.
Sat*_*vik 42
怎么样ghc -fno-code file.hs.如果您的文件没有进行类型检查,它将不会生成其他文件并显示错误.
警告:这不会对穷举模式匹配进行分析,因此如果您需要这些额外的有用警告,请不要单独使用此选项.
Dan*_*ner 11
这是一个黑客:
crabgrass:~/programming% ghc test.hs -e 'return 0'
test.hs:1:7:
No instance for (Num (a0 -> t0))
arising from the literal `3'
Possible fix: add an instance declaration for (Num (a0 -> t0))
In the expression: 3
In the expression: 3 4
In an equation for `foo': foo = 3 4
zsh: exit 1 ghc test.hs -e 'return 0'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2034 次 |
| 最近记录: |