Skip to content

Refactor RecordUpd

Refactoring of record update syntax is required.

Currently, RecordUpd looks like this:

  | RecordUpd
      { rupd_ext  :: XRecordUpd p
      , rupd_expr :: LHsExpr p
      , rupd_flds :: Either [LHsRecUpdField p] [LHsRecUpdProj p]
      }

The Right case was added in support of OverloadedRecordUpdates.

We intend to refactor LHsRecUpdField to something based on NonEmpty and use it to eliminate LHsRecUpdProj and get RecordUpd to read

  | RecordUpd
      { rupd_ext  :: XRecordUpd p
      , rupd_expr :: LHsExpr p
      , rupd_flds :: [LHsRecUpdField p]
      }

See discussion in MR 4532 for some discussion. Branch wip/T18599-rec-update-rep-nonempty contains an implementation of the idea in which

type HsRecUpdField p     = HsRecField' (NonEmpty (AmbiguousFieldOcc p)) (LHsExpr p)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information