Skip to content

Introduce TcRnWithHsDocContext

Currently GHC uses withHsDocContext to attach a HsDocContext to an error message. Here's an example:

addErr $ mkTcRnUnknownMessage $ mkPlainError noHints (withHsDocContext ctxt msg)

The problem with this is that this approach only works with TcRnUnknownMessage. But could we attach an HsDocContext to a structured error message? In !9227 (comment 459522), I proposed that we add the following constructor:

data TcRnMessage where
  ...
  TcRnWithHsDocContext :: !HsDocContext -> !TcRnMessage -> TcRnMessage
  ...

Perhaps this is not the best design possible, it is better than what we have now, so I'm going to follow through with this.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information