Skip to content

Try to simplify zoo of functions in `Tc.Utils.Monad`

Alfredo Di Napoli requested to merge wip/adinapoli-issue-19930 into master

See #18516, part of #19905 .

Fixes #19930 (closed) .

This MR does two things:

  1. 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 only TcRnMessages while we push the creation of these messages upstream. To say it differently, prior to this MR we had those functions all take an SDoc, which was clashing with #18516, which is all about having proper Haskell types as input of these functions. This MR replaces all the SDocs in those type signature with TcRnMessage;

  2. As a direct consequence of 1. new TcRnUnknownMessage cropped up everywhere, because those functions in Tc.Utils.Monad were constructing a TcRnUnknownMessage from the input SDoc, but they were doing this very deep in the call stack. This is a good thing! Now it's obvious when a new TcRnMessage 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.

Edited by Alfredo Di Napoli

Merge request reports