Proposed refactoring: parameterize Match over Pat
The data type Match
in compiler/Language/Haskell/Syntax/Expr.hs
is defined as follows:
data Match p body
= Match {
m_ext :: XCMatch p body,
m_ctxt :: HsMatchContext p,
-- See Note [m_ctxt in Match]
m_pats :: [LPat p], -- The patterns
m_grhss :: (GRHSs p body)
}
| XMatch !(XXMatch p body)
There's the body
parameter that can be instantiated to LHsExpr
or LHsCmd
, while the patterns are hardcoded to use LPat
. As it turned out in !11109 (comment 521920), we could also make use of parameterization over pat
:
- m_pats :: [LPat p], -- The patterns
+ m_pats :: [pat], -- The patterns
An attempt to make this change revealed that it has enough knock-on effects that I suggest we do it as a separate refactoring, so that !11109 (closed) can focus on actually adding support for @
-binders.