summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-06-11 23:51:44 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2016-06-13 10:57:10 +0100
commitc28dde37f3f274a2a1207dd4e175ea79769f5ead (patch)
tree7f89442a2fcad72f35a3a4dbc35ffef8e6ad15e0
parent15b9bf4ba4ab47e6809bf2b3b36ec16e502aea72 (diff)
downloadhaskell-c28dde37f3f274a2a1207dd4e175ea79769f5ead.tar.gz
Tidy up zonkQuantifiedTyVar
I managed to eliminate the strange zonkQuantifiedTyVarOrType, which is no longer used.
-rw-r--r--compiler/typecheck/TcMType.hs28
1 files changed, 7 insertions, 21 deletions
diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs
index 8f64594401..5f11e10d0b 100644
--- a/compiler/typecheck/TcMType.hs
+++ b/compiler/typecheck/TcMType.hs
@@ -71,7 +71,7 @@ module TcMType (
zonkTyCoVarsAndFV, zonkTcTypeAndFV,
zonkTyCoVarsAndFVList,
zonkTcTypeAndSplitDepVars, zonkTcTypesAndSplitDepVars,
- zonkQuantifiedTyVar, zonkQuantifiedTyVarOrType,
+ zonkQuantifiedTyVar,
quantifyTyVars, quantifyZonkedTyVars,
zonkTcTyCoVarBndr, zonkTcTyBinder, zonkTcType, zonkTcTypes, zonkCo,
zonkTyCoVarKind, zonkTcTypeMapper,
@@ -934,23 +934,9 @@ zonkQuantifiedTyVar :: Bool -- True <=> this is a kind var and -XNoPolyKind
-- * RuntimeRep variables: we never quantify over these
zonkQuantifiedTyVar default_kind tv
- = do { mb_tv' <- zonkQuantifiedTyVarOrType default_kind tv
- ; return (case mb_tv' of
- Left x -> Just x -- Quantify over this
- Right _ -> Nothing) -- Do not quantify over this
- }
-
--- | Like zonkQuantifiedTyVar, but if zonking reveals that the tyvar
--- should become a type (when defaulting a RuntimeRep var to PtrRepLifted), it
--- returns the type instead.
-zonkQuantifiedTyVarOrType :: Bool -- True <=> this is a kind var and -XNoPolyKinds
- -- False <=> not a kind var or -XPolyKindsBool
- -> TcTyVar
- -> TcM (Either TcTyVar TcType)
-zonkQuantifiedTyVarOrType default_kind tv
= case tcTyVarDetails tv of
SkolemTv {} -> do { kind <- zonkTcType (tyVarKind tv)
- ; return $ Left $ setTyVarKind tv kind }
+ ; return $ Just (setTyVarKind tv kind) }
-- It might be a skolem type variable,
-- for example from a user type signature
@@ -961,19 +947,19 @@ zonkQuantifiedTyVarOrType default_kind tv
_other -> pprPanic "zonkQuantifiedTyVar" (ppr tv) -- FlatSkol, RuntimeUnk
where
- zonk_meta_tv :: TcTyVar -> TcM (Either TcTyVar TcType)
+ zonk_meta_tv :: TcTyVar -> TcM (Maybe TcTyVar)
zonk_meta_tv tv
| isRuntimeRepVar tv -- Never quantify over a RuntimeRep var
= do { writeMetaTyVar tv ptrRepLiftedTy
- ; return (Right ptrRepLiftedTy) }
+ ; return Nothing }
| default_kind -- -XNoPolyKinds and this is a kind var
- = do { kind <- default_kind_var tv
- ; return (Right kind) }
+ = do { _ <- default_kind_var tv
+ ; return Nothing }
| otherwise
= do { tv' <- skolemiseUnboundMetaTyVar tv vanillaSkolemTv
- ; return (Left tv') }
+ ; return (Just tv') }
default_kind_var :: TyVar -> TcM Type
-- defaultKindVar is used exclusively with -XNoPolyKinds