From 4fdc523456ff6481df8d7483ae193f0c2dc2b3fe Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Mon, 31 Jul 2017 13:27:54 +0100 Subject: Use field names for all uses of datacon Match This is refactoring only... elimiante all positional uses of the data constructor Match in favour of field names. No change in behaviour. --- compiler/hsSyn/HsUtils.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'compiler/hsSyn/HsUtils.hs') diff --git a/compiler/hsSyn/HsUtils.hs b/compiler/hsSyn/HsUtils.hs index f409c2a7d2..97ab76f986 100644 --- a/compiler/hsSyn/HsUtils.hs +++ b/compiler/hsSyn/HsUtils.hs @@ -146,7 +146,8 @@ mkSimpleMatch :: HsMatchContext (NameOrRdrName (IdP id)) -> LMatch id (Located (body id)) mkSimpleMatch ctxt pats rhs = L loc $ - Match ctxt pats Nothing (unguardedGRHSs rhs) + Match { m_ctxt = ctxt, m_pats = pats, m_type = Nothing + , m_grhss = unguardedGRHSs rhs } where loc = case pats of [] -> getLoc rhs @@ -766,8 +767,10 @@ mkPrefixFunRhs n = FunRhs { mc_fun = n mkMatch :: HsMatchContext (NameOrRdrName (IdP p)) -> [LPat p] -> LHsExpr p -> Located (HsLocalBinds p) -> LMatch p (LHsExpr p) mkMatch ctxt pats expr lbinds - = noLoc (Match ctxt (map paren pats) Nothing - (GRHSs (unguardedRHS noSrcSpan expr) lbinds)) + = noLoc (Match { m_ctxt = ctxt + , m_pats = map paren pats + , m_type = Nothing + , m_grhss = GRHSs (unguardedRHS noSrcSpan expr) lbinds }) where paren lp@(L l p) | hsPatNeedsParens p = L l (ParPat lp) | otherwise = lp -- cgit v1.2.1