X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=compiler%2FhsSyn%2FHsPat.lhs;fp=compiler%2FhsSyn%2FHsPat.lhs;h=c8867661d526d2546d912eeb348c2552a269d761;hb=f7df28a48a9d2901d9e27e0e9970b3f692bc9b3f;hp=84eadb77946b21e84bad43e09ed8bbf089fd9a5e;hpb=0a594fab8ebb0a603f6e95dd843c8e98f54148ea;p=ghc-hetmet.git diff --git a/compiler/hsSyn/HsPat.lhs b/compiler/hsSyn/HsPat.lhs index 84eadb7..c886766 100644 --- a/compiler/hsSyn/HsPat.lhs +++ b/compiler/hsSyn/HsPat.lhs @@ -177,13 +177,21 @@ data HsRecFields id arg -- A bunch of record fields -- { x = 3, y = True } -- Used for both expressions and patterns = HsRecFields { rec_flds :: [HsRecField id arg], - rec_dotdot :: Maybe Int } - -- Nothing => the normal case - -- Just n => the group uses ".." notation, - -- and the first n elts of rec_flds - -- were the user-written ones - -- (In the latter case, the remaining elts of - -- rec_flds are the non-user-written ones) + rec_dotdot :: Maybe Int } -- Note [DotDot fields] + +-- Note [DotDot fields] +-- ~~~~~~~~~~~~~~~~~~~~ +-- The rec_dotdot field means this: +-- Nothing => the normal case +-- Just n => the group uses ".." notation, +-- +-- In the latter case: +-- +-- *before* renamer: rec_flds are exactly the n user-written fields +-- +-- *after* renamer: rec_flds includes *all* fields, with +-- the first 'n' being the user-written ones +-- and the remainder being 'filled in' implicitly data HsRecField id arg = HsRecField { hsRecFieldId :: Located id, @@ -196,9 +204,12 @@ data HsRecField id arg = HsRecField { -- If you write T { x, y = v+1 }, the HsRecFields will be -- HsRecField x x True ... -- HsRecField y (v+1) False ... --- That is, for "punned" field x is immediately expanded to x=x --- but with a punning flag so we can detect it later +-- That is, for "punned" field x is expanded (in the renamer) +-- to x=x; but with a punning flag so we can detect it later -- (e.g. when pretty printing) +-- +-- If the original field was qualified, we un-qualify it, thus +-- T { A.x } means T { A.x = x } hsRecFields :: HsRecFields id arg -> [id] hsRecFields rbinds = map (unLoc . hsRecFieldId) (rec_flds rbinds)