6

Building with ghc prints beautifully formatted error messages on powershell (as in other terminals):

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
    |         ^^

But when building through stack, something goes wrong:

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

Is this a bug in stack, or is there a setting to fix it?

Thanks!

mklement0
  • 382,024
  • 64
  • 607
  • 775
user3048859
  • 192
  • 6

1 Answers1

3

Turning off "use legacy console" in the cmd options does the trick!

Seems to be due to ansi color escape sequences - thanks @LotPings

Also: stack build --color never

gives monochrome but otherwise correctly formatted error messages.

user3048859
  • 192
  • 6