[commit: ghc] wip/T8584: Split tcPatSynDecl into inferring function and general workhorse function (7fd7f6d)

git at git.haskell.org git at git.haskell.org
Sun Aug 31 11:05:54 UTC 2014


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

On branch  : wip/T8584
Link       : http://ghc.haskell.org/trac/ghc/changeset/7fd7f6d60cb8da7d7f11f921ccb9e3688d5bedcc/ghc

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

commit 7fd7f6d60cb8da7d7f11f921ccb9e3688d5bedcc
Author: Dr. ERDI Gergo <gergo at erdi.hu>
Date:   Sun Jul 27 14:10:34 2014 +0200

    Split tcPatSynDecl into inferring function and general workhorse function


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

7fd7f6d60cb8da7d7f11f921ccb9e3688d5bedcc
 compiler/typecheck/TcBinds.lhs       |  4 ++--
 compiler/typecheck/TcPatSyn.lhs      | 11 +++++++++--
 compiler/typecheck/TcPatSyn.lhs-boot |  4 ++--
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/compiler/typecheck/TcBinds.lhs b/compiler/typecheck/TcBinds.lhs
index 9db4125..441ea14 100644
--- a/compiler/typecheck/TcBinds.lhs
+++ b/compiler/typecheck/TcBinds.lhs
@@ -16,7 +16,7 @@ module TcBinds ( tcLocalBinds, tcTopBinds, tcRecSelBinds,
 
 import {-# SOURCE #-} TcMatches ( tcGRHSsPat, tcMatchesFun )
 import {-# SOURCE #-} TcExpr  ( tcMonoExpr )
-import {-# SOURCE #-} TcPatSyn ( tcPatSynDecl, tcPatSynWrapper )
+import {-# SOURCE #-} TcPatSyn ( tcInferPatSynDecl, tcPatSynWrapper )
 
 import DynFlags
 import HsSyn
@@ -419,7 +419,7 @@ tc_single :: forall thing.
           -> LHsBind Name -> TcM thing
           -> TcM (LHsBinds TcId, thing)
 tc_single _top_lvl _sig_fn _prag_fn (L _ (PatSynBind psb)) thing_inside
-  = do { (pat_syn, aux_binds) <- tcPatSynDecl psb
+  = do { (pat_syn, aux_binds) <- tcInferPatSynDecl psb
 
        ; let tything = AConLike (PatSynCon pat_syn)
              implicit_ids = (patSynMatcher pat_syn) :
diff --git a/compiler/typecheck/TcPatSyn.lhs b/compiler/typecheck/TcPatSyn.lhs
index b5fbc29..40efbfe 100644
--- a/compiler/typecheck/TcPatSyn.lhs
+++ b/compiler/typecheck/TcPatSyn.lhs
@@ -7,7 +7,7 @@
 \begin{code}
 {-# LANGUAGE CPP #-}
 
-module TcPatSyn (tcPatSynDecl, tcPatSynWrapper) where
+module TcPatSyn (tcInferPatSynDecl, tcPatSynWrapper) where
 
 import HsSyn
 import TcPat
@@ -40,13 +40,20 @@ import TypeRep
 \end{code}
 
 \begin{code}
+tcInferPatSynDecl :: PatSynBind Name Name
+                  -> TcM (PatSyn, LHsBinds Id)
+tcInferPatSynDecl psb
+  = do { pat_ty <- newFlexiTyVarTy openTypeKind
+       ; tcPatSynDecl psb pat_ty }
+
 tcPatSynDecl :: PatSynBind Name Name
+             -> TcType
              -> TcM (PatSyn, LHsBinds Id)
 tcPatSynDecl PSB{ psb_id = lname@(L _ name), psb_args = details,
                   psb_def = lpat, psb_dir = dir }
+             pat_ty
   = do { traceTc "tcPatSynDecl {" $ ppr name $$ ppr lpat
        ; tcCheckPatSynPat lpat
-       ; pat_ty <- newFlexiTyVarTy openTypeKind
 
        ; let (arg_names, is_infix) = case details of
                  PrefixPatSyn names      -> (map unLoc names, False)
diff --git a/compiler/typecheck/TcPatSyn.lhs-boot b/compiler/typecheck/TcPatSyn.lhs-boot
index 700137c..0f77400 100644
--- a/compiler/typecheck/TcPatSyn.lhs-boot
+++ b/compiler/typecheck/TcPatSyn.lhs-boot
@@ -7,8 +7,8 @@ import HsSyn     ( PatSynBind, LHsBinds )
 import TcRnTypes ( TcM )
 import PatSyn    ( PatSyn )
 
-tcPatSynDecl :: PatSynBind Name Name
-             -> TcM (PatSyn, LHsBinds Id)
+tcInferPatSynDecl :: PatSynBind Name Name
+                  -> TcM (PatSyn, LHsBinds Id)
 
 tcPatSynWrapper :: PatSynBind Name Name
                 -> TcM (LHsBinds Id)



More information about the ghc-commits mailing list