`Messages` can't be easily printed for debugging purposes
When debugging #19693 (closed) I saw that the error output of deSugarExpr
was being ignored, I wanted to print it out to see if there were some errors that we were ignoring. It turns out there isn't a very convenient way to display Messages
, I ended up with something like this:
761 unless (isEmptyMessages msgs) $ do
762 let ms = getWarningMessages msgs
763 ers = getErrorMessages msgs
764 pprTraceM "msgs" (vcat [ppr (text . show <$> ms), ppr (text . show <$> ers)])
In addition to this, there's a Show
instance for MsgEnvelope
but not an Outputable
instance, and for Bag
, there's only an Outputable
instance, but no Show
instance, this leads to the awkward text . show <$> ...
.
Proposal: Introduce an Outputable
instance for Messages
or at least a function debugPprMessages :: Messages -> SDoc
.