Skip to content

Proposed refactoring: Make lambda and \case use the same constructor.

The \case and \cases AST nodes are defined by a single constructor, but lambda isn't:

  | HsLam     (XLam p)                    (MatchGroup p (LHsExpr p))
  | HsLamCase (XLamCase p) LamCaseVariant (MatchGroup p (LHsExpr p))

XLam actually is NoExtField, so we can merge these data constructors without any additional problems. The main change:

data LamCaseVariant
  = LamCase -- ^ `\case`
  | LamCases -- ^ `\cases`
+  | Lambda   -- ^ `\`

data HsExpr p =
  ...
-  | HsLam     (XLam p)                    (MatchGroup p (LHsExpr p))
  ...

And the same for HsCmdLam

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