HLS Structured Errors Integration
Motivation
If this is not the right place for this request please feel free to close/move this.
With the introduction of Typed Error Diagnostics in GHC, the Haskell Language Server project is looking to provide feedback based on various use-cases. HLS has a meta-issue located here with the original request for feedback.
There is a current WIP around providing a mechanism to update/change type signatures #2660, which is looking to leverage this diagnostic information. The current approach is to scrub the Pretty Printed Error messages using regex to look for specific messages and subsequently pulling out any type information from the message. There are many variations to the displayed error message depending on the context, which drastically complicates the process of determining what the new signature should actually be.
Similarly, there is a mechanism in HLS to supply a signature to top-level binds (who don't already have one). This action also scrubs messages via regex in order to find bindings with no type signature (or pattern signature).
Digging through the code (more specifically https://gitlab.haskell.org/ghc/ghc/-/blob/master/compiler/GHC/Tc/Errors/Types.hs#L2031) it looks like this has already been implemented to a certain extent. HLS is not yet able to build with GHC HEAD, and the integration with structured error diagnostics is still in the air, so it is still unclear how accessible these type diagnostics are for HLS.
To sum up: the two HLS features mentioned above would benefit greatly from Typed Diagnostics. The main question being -- How feasible is it to provide the information in order to always work out the ACTUAL type of a binding? Judging by the data types linked above, one would presume that this information should always be available.