GHC API: Export "flagMsg" function from "defaultLogAction"
Motivation
The mkLocMessageAnn
function is available in the GHC API to format an error message into a default text output.
This is useful for clients of the GHC API, but what we are missing is the way to format the warning flag.
The way defaultLogAction
does it is by using an internal function called flagMsg
.
Here is the current code: https://gitlab.haskell.org/ghc/ghc/-/blob/cc1ba576d26b90c0c01aa43e7100c94ee3a287ad/compiler/GHC/Utils/Logger.hs#L246
Proposal
I propose that flagMsg
be refactored out of defaultLogAction
and then also exported to be part of the public GHC API. It should also be given a suitable name.
Current workaround: Clients can Copy&Paste the code of flagMsg
(and all of its helper functions) into their project.
Thank you