Haskell full file template error

I am writing a TH library and I have a situation where I am doing some modular things. In a nutshell, I collect information from all quasquatics and putQ-in it in Q.

Then, after the Haskell module has been typechecked checked, I look at all this state and do something with it. I manage this by recording this final action when used addModFinalizer.

Now the problem: sometimes this final action may fail. If so, I want to report a compilation error. By doing this with help fail, I get error messages that look like this:

Main.hs:1:1: error: My message of something going wrong with the whole module...
  |
1 | {-# LANGUAGE TemplateHaskell, QuasiQuotes #-}
  | ^

As you can see, GHC decides to link my error message to a file. Is there any way to tell GHC not to associate my error with a bit of code? I would prefer something like:

Main.hs: error: My message of something going wrong with the whole module...
+4
source share

Source: https://habr.com/ru/post/1690144/


All Articles