
#12206: No exposed API to get full text of ErrMsg -------------------------------------+------------------------------------- Reporter: bit | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHC API | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- In GHC version 7.10.3 it was possible to get the full text of an error message by using the functions `ErrUtils.errMsgShortDoc` and `ErrUtils.errMsgExtraInfo`. But in GHC version 8.0.1 the code has changed. The full text of the error message is stored in the `ErrMsg` field `ErrUtils.errMsgDoc`, but this field is hidden, and there doesn't seem to be any API to access its contents. The only workaround I can find is to use `ErrUtils.pprLocErrMsg`, and then strip out the first line containing the location info, and then manually unindent the 4-space "hang". This is quite ugly. I suggest exporting `ErrUtils.errMsgDoc`, and then for that to be useful the fields of `ErrUtils.ErrDoc` will also be needed. Additionally, `ErrUtils.formatErrDoc` could be a nice bonus to have (and if exported would lessen the need for the `ErrDoc` fields). The GHC API changes on every GHC release, so since backwards compatibility is not an issue, it would seem that there is no need to have a carefully exposed API, and there is no danger in liberally exporting stuff that clients could potentially find useful. Thank you -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12206 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler