使用ghc构建在powershell上打印格式错误的错误消息(如在其他终端中):
PS > ghc .\src\XXX.hs -package ghc -package ghc-paths -package filepath
[1 of 1] Compiling XXX ( src\XXX.hs, src\XXX.o )
src\XXX.hs:340:9: error:
parse error on input `<-'
Perhaps this statement should be within a 'do' block?
|
340 | blah <- blah blah blah
| ^^
但是当通过堆栈构建时,出现了问题:
PS > stack build
XXX-0.1.0.0: build (lib + exe)
Preprocessing library for XXX-0.1.0.0..
Building library for XXX-0.1.0.0..
[2 of 3] Compiling XXX ( src\XXX.hs, .stack-work\dist\5c8418a7\build\XXX.o )
←[;1msrc\XXX.hs:340:9: ←[;1m←[31merror:←[0m←[0m←[;1m←[0m←[0m←[;1m
parse error on input `<-'
Perhaps this statement should be within a 'do' block?←[0m←[0m
←[;1m←[34m |←[0m←[0m
←[;1m←[34m340 |←[0m←[0m blah ←[;1m←[31m<-←[0m←[0m blah blah blah
←[;1m←[34m |←[0m←[0m←[;1m←[31m ^^←[0m←[0m
←[0m←[0m←[0m
这是堆栈中的错误,还是有设置来修复它?
谢谢!
答案 0 :(得分:3)
关闭&#34;使用传统控制台&#34;在cmd选项中做了诀窍!
似乎是由于ansi颜色转义序列 - 感谢@LotPings
此外: 堆栈构建--color never
提供单色但正确格式化的错误消息。