Try to simplify zoo of functions in `Tc.Utils.Monad`
Fixes #19930 (closed) .
This MR does two things:
-
It tries to untangle, cleanup and simplify the zoo of diagnostic-related functions in
Tc.Utils.Monad
so that we can have the interfaces mention onlyTcRnMessage
s while we push the creation of these messages upstream. To say it differently, prior to this MR we had those functions all take anSDoc
, which was clashing with #18516, which is all about having proper Haskell types as input of these functions. This MR replaces all theSDoc
s in those type signature withTcRnMessage
; -
As a direct consequence of
1.
newTcRnUnknownMessage
cropped up everywhere, because those functions inTc.Utils.Monad
were constructing aTcRnUnknownMessage
from the inputSDoc
, but they were doing this very deep in the call stack. This is a good thing! Now it's obvious when a newTcRnMessage
is generated (i.e.grep TcRnUnknownMessage
) and the best part is that we can offload all the porting of these errors to newcomers or eager Haskell developers.