[commit: ghc] master: Generalise type of mkMatchGroup to unify with mkMatchGroupName (158288b)

git at git.haskell.org git at git.haskell.org
Sun Sep 11 13:39:03 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/158288bdd4e2391982936f796f3004d7d7b5d8df/ghc

>---------------------------------------------------------------

commit 158288bdd4e2391982936f796f3004d7d7b5d8df
Author: Matthew Pickering <matthewtpickering at gmail.com>
Date:   Sun Sep 11 14:33:14 2016 +0100

    Generalise type of mkMatchGroup to unify with mkMatchGroupName


>---------------------------------------------------------------

158288bdd4e2391982936f796f3004d7d7b5d8df
 compiler/hsSyn/HsUtils.hs | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/compiler/hsSyn/HsUtils.hs b/compiler/hsSyn/HsUtils.hs
index 641aac1..118e551 100644
--- a/compiler/hsSyn/HsUtils.hs
+++ b/compiler/hsSyn/HsUtils.hs
@@ -152,8 +152,9 @@ unguardedGRHSs rhs@(L loc _)
 unguardedRHS :: SrcSpan -> Located (body id) -> [LGRHS id (Located (body id))]
 unguardedRHS loc rhs = [L loc (GRHS [] rhs)]
 
-mkMatchGroup :: Origin -> [LMatch RdrName (Located (body RdrName))]
-             -> MatchGroup RdrName (Located (body RdrName))
+mkMatchGroup :: (PostTc name Type ~ PlaceHolder)
+             => Origin -> [LMatch name (Located (body name))]
+             -> MatchGroup name (Located (body name))
 mkMatchGroup origin matches = MG { mg_alts = mkLocatedList matches
                                  , mg_arg_tys = []
                                  , mg_res_ty = placeHolderType
@@ -165,10 +166,7 @@ mkLocatedList ms = L (combineLocs (head ms) (last ms)) ms
 
 mkMatchGroupName :: Origin -> [LMatch Name (Located (body Name))]
              -> MatchGroup Name (Located (body Name))
-mkMatchGroupName origin matches = MG { mg_alts = mkLocatedList matches
-                                     , mg_arg_tys = []
-                                     , mg_res_ty = placeHolderType
-                                     , mg_origin = origin }
+mkMatchGroupName = mkMatchGroup
 
 mkHsApp :: LHsExpr name -> LHsExpr name -> LHsExpr name
 mkHsApp e1 e2 = addCLoc e1 e2 (HsApp e1 e2)



More information about the ghc-commits mailing list