Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the way GHC compiler error messages are printed out? [closed]

I am not fully satisfied with the format of GHC error messages. How can I make a custom print function?

like image 753
xged Avatar asked Jan 24 '26 22:01

xged


1 Answers

You want to modify GHC? well, it's open-source so you can change it however you wish and recompile but that would probably be a gigantic overkill.

If I really really wanted to, I'd make a program that calls GHC with the arguments it receives, read back the output, process it, then print it.

You can do it with System.Process.readProcessWithExitCode, specifically.
You might be tempted to use readProcess for its easier API, but it will only read from stdout and you're almost certainly want stderr too.
Plus the exit-code in the former function could be very helpful too: you could know if compilation succeeded or not without even parsing, but by just seeing if the exit code = 0.

like image 181
MasterMastic Avatar answered Jan 28 '26 00:01

MasterMastic