[commit: ghc] wip/gadtpm: No more need for function matchCheck (d86218d)

git at git.haskell.org git at git.haskell.org
Thu Sep 17 13:01:44 UTC 2015


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

On branch  : wip/gadtpm
Link       : http://ghc.haskell.org/trac/ghc/changeset/d86218d08982f17ed49ec1896a06b3cf3ef25e05/ghc

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

commit d86218d08982f17ed49ec1896a06b3cf3ef25e05
Author: George Karachalias <george.karachalias at gmail.com>
Date:   Thu Sep 17 14:14:10 2015 +0200

    No more need for function matchCheck


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

d86218d08982f17ed49ec1896a06b3cf3ef25e05
 compiler/deSugar/Match.hs | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)

diff --git a/compiler/deSugar/Match.hs b/compiler/deSugar/Match.hs
index f11a0f8..d542613 100644
--- a/compiler/deSugar/Match.hs
+++ b/compiler/deSugar/Match.hs
@@ -52,23 +52,6 @@ import Control.Monad( when, unless )
 import qualified Data.Map as Map
 
 {-
-This function is a wrapper of @match@, it must be called from all the parts where
-it was called match, but only substitutes the first call, ....
-if the associated flags are declared, warnings will be issued.
-It can not be called matchWrapper because this name already exists :-(
-
-JJCQ 30-Nov-1997
--}
-
-matchCheck :: DsMatchContext
-           -> [Id]             -- Vars rep'ing the exprs we're matching with
-           -> Type             -- Type of the case expression
-           -> [EquationInfo]   -- Info about patterns, etc. (type synonym below)
-           -> DsM MatchResult  -- Desugared result!
-
-matchCheck _ctx vars ty qs = match vars ty qs -- remove this function maybe?
-
-{-
 ************************************************************************
 *                                                                      *
                 The main matching function
@@ -735,10 +718,9 @@ matchEquations  :: HsMatchContext Name
                 -> DsM CoreExpr
 matchEquations ctxt vars eqns_info rhs_ty
   = do  { locn <- getSrcSpanDs
-        ; let   ds_ctxt   = DsMatchContext ctxt locn
-                error_doc = matchContextErrString ctxt
+        ; let error_doc = matchContextErrString ctxt
 
-        ; match_result <- matchCheck ds_ctxt vars rhs_ty eqns_info
+        ; match_result <- match vars rhs_ty eqns_info
 
         ; fail_expr <- mkErrorAppDs pAT_ERROR_ID rhs_ty error_doc
         ; extractMatchResult match_result fail_expr }
@@ -782,9 +764,8 @@ matchSinglePat (Var var) ctx (L _ pat) ty match_result
        -- pattern match check warnings
        ; dsPmWarn dflags (DsMatchContext ctx locn) (checkSingle var pat)
 
-       ; matchCheck (DsMatchContext ctx locn)
-                    [var] ty
-                    [EqnInfo { eqn_pats = [pat], eqn_rhs  = match_result }] }
+       ; match [var] ty
+               [EqnInfo { eqn_pats = [pat], eqn_rhs  = match_result }] }
 
 matchSinglePat scrut hs_ctx pat ty match_result
   = do { var <- selectSimpleMatchVarL pat



More information about the ghc-commits mailing list