Skip to content

WIP: Introduce hsExprType

Ben Gamari requested to merge wip/hs-expr-type into master

There have been several requests over the past year for better support for inspecting the types of hsSyn terms (#17331, #15320, #16804). This patch introduces a new TTG pass, With, which decorates all HsExpr nodes with a given type and the following functions:

hsExprType :: HsExpr GhcTc -> HsExpr (With Type GhcTc)

project :: HsExpr (With a p) -> a

This interface should be flexible enough to allow all of the above tickets to be efficiently addressed.

To do

  • The name With is a bit vague; it should mention the fact that it is decorating only Expr nodes
  • There are a few undefined sprinkled about that need to be filled in
  • Tests

Merge request reports