[Git][ghc/ghc][wip/sand-witch/lazy-skol-exp-pat-tys] fixup! Lazy skolemisation for @a-binders (17594)

Andrei Borzenkov (@sand-witch) gitlab at gitlab.haskell.org
Thu Dec 14 14:32:47 UTC 2023



Andrei Borzenkov pushed to branch wip/sand-witch/lazy-skol-exp-pat-tys at Glasgow Haskell Compiler / GHC


Commits:
4bbf51a4 by Andrei Borzenkov at 2023-12-14T18:32:39+04:00
fixup! Lazy skolemisation for @a-binders (17594)

- - - - -


1 changed file:

- compiler/GHC/Tc/Gen/Pat.hs


Changes:

=====================================
compiler/GHC/Tc/Gen/Pat.hs
=====================================
@@ -138,32 +138,11 @@ tcPats :: HsMatchContext GhcTc
 --   3. Check the body
 --   4. Check that no existentials escape
 
-tcPats ctxt pats pat_tys thing_inside = do
-    pat_tys' <- filter_exp_tys pats pat_tys
-    tc_tt_lpats pat_tys' penv pats thing_inside
+tcPats ctxt pats pat_tys thing_inside =
+    tc_tt_lpats (filterOut isExpForAllPatTyInvis pat_tys) penv pats thing_inside
   where
     penv = PE { pe_lazy = False, pe_ctxt = LamPat ctxt, pe_orig = PatOrigin }
 
-    filter_exp_tys :: [LPat GhcRn] -> [ExpPatType] -> TcM ([ExpPatType])
-
-    filter_exp_tys [] rest = pure (drop_invis_pats rest)
-
-    -- visible patterns
-    filter_exp_tys pats@(L _ _ : _) (ExpForAllPatTy (Bndr _ Invisible{}) : pat_tys) =
-      filter_exp_tys pats (drop_invis_pats pat_tys)
-    filter_exp_tys (L _ _ : pats) (p : pat_tys) = do
-      (pat_tys') <- filter_exp_tys pats pat_tys
-      pure (p : pat_tys')
-
-    -- invisible patterns
-    -- There are no at the moment
-
-    filter_exp_tys (L _  _ :_) [] =
-      panic "filter_exp_tys: expected patterns more then expected pattern types"
-
-    drop_invis_pats (ExpForAllPatTy (Bndr _ Invisible{}) : pat_tys) = drop_invis_pats pat_tys
-    drop_invis_pats pat_tys = pat_tys
-
 tcInferPat :: FixedRuntimeRepContext
            -> HsMatchContext GhcTc
            -> LPat GhcRn



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4bbf51a4e91252939ba9fa99233317b1956f7d43

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4bbf51a4e91252939ba9fa99233317b1956f7d43
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231214/c621312d/attachment-0001.html>


More information about the ghc-commits mailing list