summaryrefslogtreecommitdiff
path: root/compiler/typecheck/TcRnTypes.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/typecheck/TcRnTypes.hs')
-rw-r--r--compiler/typecheck/TcRnTypes.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs
index 1ae809fd99..a29ad92f18 100644
--- a/compiler/typecheck/TcRnTypes.hs
+++ b/compiler/typecheck/TcRnTypes.hs
@@ -102,6 +102,7 @@ module TcRnTypes(
pprCtOrigin, pprCtLoc,
pushErrCtxt, pushErrCtxtSameOrigin,
+
SkolemInfo(..), pprSigSkolInfo, pprSkolInfo,
termEvidenceAllowed,
@@ -110,6 +111,8 @@ module TcRnTypes(
isWanted, isGiven, isDerived, isGivenOrWDeriv,
ctEvRole,
+ wrapType,
+
-- Constraint solver plugins
TcPlugin(..), TcPluginResult(..), TcPluginSolver,
TcPluginM, runTcPluginM, unsafeTcPluginTcM,
@@ -2484,6 +2487,18 @@ pprEvVarTheta ev_vars = pprTheta (map evVarPred ev_vars)
pprEvVarWithType :: EvVar -> SDoc
pprEvVarWithType v = ppr v <+> dcolon <+> pprType (evVarPred v)
+
+
+-- | Wraps the given type with the constraints (via ic_given) in the given
+-- implication, according to the variables mentioned (via ic_skols)
+-- in the implication.
+wrapType :: Type -> Implication -> Type
+wrapType ty (Implic {ic_skols = skols, ic_given=givens}) =
+ wrapWithAllSkols $ mkFunTys (map idType givens) $ ty
+ where forAllTy :: Type -> TyVar -> Type
+ forAllTy ty tv = mkForAllTy tv Specified ty
+ wrapWithAllSkols ty = foldl forAllTy ty skols
+
{-
************************************************************************
* *