[Git][ghc/ghc][wip/sand-witch/lazy-skol] Re-add reconstructType
Simon Peyton Jones (@simonpj)
gitlab at gitlab.haskell.org
Tue Jan 23 12:30:04 UTC 2024
Simon Peyton Jones pushed to branch wip/sand-witch/lazy-skol at Glasgow Haskell Compiler / GHC
Commits:
259ce0bc by Simon Peyton Jones at 2024-01-23T12:29:48+00:00
Re-add reconstructType
- - - - -
1 changed file:
- compiler/GHC/Tc/Utils/TcType.hs
Changes:
=====================================
compiler/GHC/Tc/Utils/TcType.hs
=====================================
@@ -30,7 +30,7 @@ module GHC.Tc.Utils.TcType (
ExpType(..), InferResult(..),
ExpTypeFRR, ExpSigmaType, ExpSigmaTypeFRR,
ExpRhoType,
- mkCheckExpType,
+ mkCheckExpType, reconstructCheckType,
checkingExpType_maybe, checkingExpType,
ExpPatType(..), mkInvisExpPatType, isExpForAllPatTyInvis, isExpFunPatTy,
@@ -475,6 +475,18 @@ isExpFunPatTy :: ExpPatType -> Bool
isExpFunPatTy ExpFunPatTy{} = True
isExpFunPatTy ExpForAllPatTy{} = False
+reconstructCheckType :: [ExpPatType] -> ExpType -> TcType
+-- Precondition: all the arguments are Check{}
+reconstructCheckType pat_tys res_ty
+ = foldr go (checkingExpType res_ty) pat_tys
+ where
+ go :: ExpPatType -> TcType -> TcType
+ go (ExpFunPatTy (Scaled u v)) res_ty
+ = tcMkVisFunTy u (checkingExpType v) res_ty
+ go (ExpForAllPatTy bndr) res_ty
+ | isVisibleForAllTyBinder bndr = mkForAllTy bndr res_ty
+ | otherwise = res_ty
+
instance Outputable ExpPatType where
ppr (ExpFunPatTy t) = ppr t
ppr (ExpForAllPatTy tv) = text "forall" <+> ppr tv
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/259ce0bcd7d6eb4de62ba37167eb7f6643ce01a5
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/259ce0bcd7d6eb4de62ba37167eb7f6643ce01a5
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/20240123/99a660fc/attachment-0001.html>
More information about the ghc-commits
mailing list