How can I change the way the GHC compiler displays error messages?

I am not completely satisfied with the GHC error message format. How do I create a custom print function?

+3


source to share


1 answer


Do you want to change GHC? well, it's open source, so you can change it however you want and recompile, but that would probably be a giant overkill.

If I really wanted to, I would make a program that calls GHC with the arguments it receives, reads the output, processes it, and then prints.



You can do this with System.Process

. readProcessWithExitCode

, in particular.
You might be tempted to use the readProcess

simpler API for it, but it will only read from stdout

, and you almost certainly want it stderr

too.
Plus the exit code in the previous function can also be very helpful: you could know if the compilation succeeded or not, even without parsing, but just by looking if there is an exit code = 0.

+2


source







All Articles