getInstEnvs, getFamInstEnvs, -- Getting the environments
getTopEnv, getGblEnv, getTcEvBinds, getUntouchablesTcS,
- getTcEvBindsBag, getTcSContext,
+ getTcEvBindsBag, getTcSContext, getTcSTyBinds, getTcSTyBindsBag,
newFlattenSkolemTy, -- Flatten skolems
+
instDFunTypes, -- Instantiation
instDFunConstraints,
import HscTypes
import BasicTypes
-import Type
import Inst
import InstEnv
import Coercion
import Class
import TyCon
+import TypeRep
+
import Name
import Var
import Outputable
isGiven _ = False
isDerived :: CtFlavor -> Bool
-isDerived ctid = not $ isGiven ctid || isWanted ctid
+isDerived (Derived {}) = True
+isDerived _ = False
canRewrite :: CtFlavor -> CtFlavor -> Bool
-- canRewrite ctid1 ctid2
; return (res, evBindMapBinds ev_binds) }
where
do_unification (tv,ty) = TcM.writeMetaTyVar tv ty
+
nestImplicTcS :: EvBindsVar -> TcTyVarSet -> TcS a -> TcS a
nestImplicTcS ref untouch tcs
getTcSTyBinds :: TcS (IORef (Bag (TcTyVar, TcType)))
getTcSTyBinds = TcS (return . tcs_ty_binds)
+getTcSTyBindsBag :: TcS (Bag (TcTyVar, TcType))
+getTcSTyBindsBag = getTcSTyBinds >>= wrapTcS . (TcM.readTcRef)
+
+
getTcEvBindsBag :: TcS EvBindMap
getTcEvBindsBag
= do { EvBindsVar ev_ref _ <- getTcEvBinds
newFlattenSkolemTyVar ty
= wrapTcS $ do { uniq <- TcM.newUnique
; let name = mkSysTvName uniq (fsLit "f")
- ; return $ mkTcTyVar name (typeKind ty) (FlatSkol ty)
+ ; return $
+ mkTcTyVar name (typeKind ty) (FlatSkol ty)
}
-- Instantiations