TcSMonad

ghc-7.10.2: The GHC API

Safe Haskell | None
Language | Haskell2010

TcSMonad

Synopsis

- data WorkList = WL {
  - wl_eqs :: [Ct]
  - wl_funeqs :: [Ct]
  - wl_rest :: [Ct]
  - wl_implics :: Bag Implication
  }
- isEmptyWorkList :: WorkList -> Bool
- emptyWorkList :: WorkList
- extendWorkListNonEq :: Ct -> WorkList -> WorkList
- extendWorkListCt :: Ct -> WorkList -> WorkList
- extendWorkListCts :: [Ct] -> WorkList -> WorkList
- appendWorkList :: WorkList -> WorkList -> WorkList
- selectWorkItem :: WorkList -> (Maybe Ct, WorkList)
- workListSize :: WorkList -> Int
- updWorkListTcS :: (WorkList -> WorkList) -> TcS ()
- updWorkListTcS_return :: (WorkList -> (a, WorkList)) -> TcS a
- runFlatten :: TcS a -> TcS a
- emitFlatWork :: Ct -> TcS ()
- data TcS a
- runTcS :: TcS a -> TcM (a, Bag EvBind)
- runTcSWithEvBinds :: EvBindsVar -> TcS a -> TcM a
- failTcS :: SDoc -> TcS a
- tryTcS :: TcS a -> TcS a
- nestTcS :: TcS a -> TcS a
- nestImplicTcS :: EvBindsVar -> TcLevel -> TcS a -> TcS a
- recoverTcS :: TcS a -> TcS a -> TcS a
- runTcPluginTcS :: TcPluginM a -> TcS a
- addUsedRdrNamesTcS :: [RdrName] -> TcS ()
- deferTcSForAllEq :: Role -> CtLoc -> ([TyVar], TcType) -> ([TyVar], TcType) -> TcS EvTerm
- panicTcS :: SDoc -> TcS a
- traceTcS :: String -> SDoc -> TcS ()
- traceFireTcS :: CtEvidence -> SDoc -> TcS ()
- bumpStepCountTcS :: TcS ()
- csTraceTcS :: SDoc -> TcS ()
- wrapErrTcS :: TcM a -> TcS a
- wrapWarnTcS :: TcM a -> TcS a
- data XEvTerm = XEvTerm {
  - ev_preds :: [PredType]
  - ev_comp :: [EvTerm] -> EvTerm
  - ev_decomp :: EvTerm -> [EvTerm]
  }
- data Freshness
  - = Fresh
  - | Cached
- freshGoals :: [(CtEvidence, Freshness)] -> [CtEvidence]
- isFresh :: Freshness -> Bool
- newTcEvBinds :: TcS EvBindsVar
- newWantedEvVar :: CtLoc -> TcPredType -> TcS (CtEvidence, Freshness)
- newWantedEvVarNC :: CtLoc -> TcPredType -> TcS CtEvidence
- setWantedTyBind :: TcTyVar -> TcType -> TcS ()
- reportUnifications :: TcS a -> TcS (Bool, a)
- setEvBind :: EvVar -> EvTerm -> TcS ()
- newEvVar :: TcPredType -> TcS EvVar
- newGivenEvVar :: CtLoc -> (TcPredType, EvTerm) -> TcS CtEvidence
- newGivenEvVars :: CtLoc -> [(TcPredType, EvTerm)] -> TcS [CtEvidence]
- newDerived :: CtLoc -> TcPredType -> TcS (Maybe CtEvidence)
- emitNewDerived :: CtLoc -> TcPredType -> TcS ()
- instDFunConstraints :: CtLoc -> TcThetaType -> TcS [(CtEvidence, Freshness)]
- getInstEnvs :: TcS InstEnvs
- getFamInstEnvs :: TcS (FamInstEnv, FamInstEnv)
- getTopEnv :: TcS HscEnv
- getGblEnv :: TcS TcGblEnv
- getTcEvBinds :: TcS EvBindsVar
- getTcLevel :: TcS TcLevel
- getTcEvBindsMap :: TcS EvBindMap
- data InertSet = IS {
  - inert_cans :: InertCans
  - inert_flat_cache :: FunEqMap (TcCoercion, TcType, CtFlavour)
  - inert_solved_dicts :: DictMap CtEvidence
  }
- data InertCans = IC {
  - inert_eqs :: TyVarEnv EqualCtList
  - inert_funeqs :: FunEqMap Ct
  - inert_dicts :: DictMap Ct
  - inert_irreds :: Cts
  - inert_insols :: Cts
  }
- updInertTcS :: (InertSet -> InertSet) -> TcS ()
- updInertCans :: (InertCans -> InertCans) -> TcS ()
- updInertDicts :: (DictMap Ct -> DictMap Ct) -> TcS ()
- updInertIrreds :: (Cts -> Cts) -> TcS ()
- getNoGivenEqs :: TcLevel -> [TcTyVar] -> TcS Bool
- setInertCans :: InertCans -> TcS ()
- getInertEqs :: TcS (TyVarEnv EqualCtList)
- getInertCans :: TcS InertCans
- emptyInert :: InertSet
- getTcSInerts :: TcS InertSet
- setTcSInerts :: InertSet -> TcS ()
- getUnsolvedInerts :: TcS (Bag Implication, Cts, Cts, Cts, Cts)
- checkAllSolved :: TcS Bool
- splitInertCans :: InertCans -> ([Ct], [Ct], [Ct])
- removeInertCts :: [Ct] -> InertCans -> InertCans
- prepareInertsForImplications :: InertSet -> InertSet
- addInertCan :: InertCans -> Ct -> InertCans
- insertInertItemTcS :: Ct -> TcS ()
- insertFunEq :: FunEqMap a -> TyCon -> [Type] -> a -> FunEqMap a
- emitInsoluble :: Ct -> TcS ()
- emitWorkNC :: [CtEvidence] -> TcS ()
- type EqualCtList = [Ct]
- lookupInertDict :: InertCans -> CtLoc -> Class -> [Type] -> Maybe CtEvidence
- findDictsByClass :: DictMap a -> Class -> Bag a
- addDict :: DictMap a -> Class -> [Type] -> a -> DictMap a
- addDictsByClass :: DictMap Ct -> Class -> Bag Ct -> DictMap Ct
- delDict :: DictMap a -> Class -> [Type] -> DictMap a
- partitionDicts :: (Ct -> Bool) -> DictMap Ct -> (Bag Ct, DictMap Ct)
- findTyEqs :: InertCans -> TyVar -> EqualCtList
- addSolvedDict :: CtEvidence -> Class -> [Type] -> TcS ()
- lookupSolvedDict :: InertSet -> CtLoc -> Class -> [Type] -> Maybe CtEvidence
- lookupFlatCache :: TyCon -> [Type] -> TcS (Maybe (TcCoercion, TcType, CtFlavour))
- extendFlatCache :: TyCon -> [Type] -> (TcCoercion, TcType, CtFlavour) -> TcS ()
- newFlattenSkolem :: CtFlavour -> CtLoc -> TcType -> TcS (CtEvidence, TcTyVar)
- updInertFunEqs :: (FunEqMap Ct -> FunEqMap Ct) -> TcS ()
- findFunEq :: FunEqMap a -> TyCon -> [Type] -> Maybe a
- sizeFunEqMap :: FunEqMap a -> Int
- findFunEqsByTyCon :: FunEqMap a -> TyCon -> [a]
- findFunEqs :: FunEqMap a -> TyCon -> [Type] -> Maybe a
- partitionFunEqs :: (Ct -> Bool) -> FunEqMap Ct -> ([Ct], FunEqMap Ct)
- instDFunType :: DFunId -> [DFunInstType] -> TcS ([TcType], TcType)
- newFlexiTcSTy :: Kind -> TcS TcType
- instFlexiTcS :: [TKVar] -> TcS (TvSubst, [TcType])
- instFlexiTcSHelperTcS :: Name -> Kind -> TcS TcType
- cloneMetaTyVar :: TcTyVar -> TcS TcTyVar
- demoteUnfilledFmv :: TcTyVar -> TcS ()
- data TcLevel
- isTouchableMetaTyVarTcS :: TcTyVar -> TcS Bool
- isFilledMetaTyVar_maybe :: TcTyVar -> TcS (Maybe Type)
- isFilledMetaTyVar :: TcTyVar -> TcS Bool
- zonkTyVarsAndFV :: TcTyVarSet -> TcS TcTyVarSet
- zonkTcType :: TcType -> TcS TcType
- zonkTcTyVar :: TcTyVar -> TcS TcType
- zonkSimples :: Cts -> TcS Cts
- newTcRef :: a -> TcS (TcRef a)
- readTcRef :: TcRef a -> TcS a
- updTcRef :: TcRef a -> (a -> a) -> TcS ()
- getDefaultInfo :: TcS ([Type], (Bool, Bool))
- getDynFlags :: HasDynFlags m => m DynFlags
- getGlobalRdrEnvTcS :: TcS GlobalRdrEnv
- matchFam :: TyCon -> [Type] -> TcS (Maybe (TcCoercion, TcType))
- matchFamTcM :: TyCon -> [Type] -> TcM (Maybe (TcCoercion, TcType))
- checkWellStagedDFun :: PredType -> DFunId -> CtLoc -> TcS ()
- pprEq :: TcType -> TcType -> SDoc

# Documentation

data WorkList Source

Constructors

WL |
Fields wl_eqs :: [Ct] wl_funeqs :: [Ct] wl_rest :: [Ct] wl_implics :: Bag Implication

Instances

Outputable WorkList |

isEmptyWorkList :: WorkList -> Bool Source

emptyWorkList :: WorkList Source

extendWorkListNonEq :: Ct -> WorkList -> WorkList Source

extendWorkListCt :: Ct -> WorkList -> WorkList Source

extendWorkListCts :: [Ct] -> WorkList -> WorkList Source

appendWorkList :: WorkList -> WorkList -> WorkList Source

selectWorkItem :: WorkList -> (Maybe Ct, WorkList) Source

workListSize :: WorkList -> Int Source

updWorkListTcS :: (WorkList -> WorkList) -> TcS () Source

updWorkListTcS_return :: (WorkList -> (a, WorkList)) -> TcS a Source

runFlatten :: TcS a -> TcS a Source

emitFlatWork :: Ct -> TcS () Source

data TcS a Source

Instances

Monad TcS |
Functor TcS |
Applicative TcS |
MonadUnique TcS |
HasDynFlags TcS |

runTcS :: TcS a -> TcM (a, Bag EvBind) Source

runTcSWithEvBinds :: EvBindsVar -> TcS a -> TcM a Source

failTcS :: SDoc -> TcS a Source

tryTcS :: TcS a -> TcS a Source

nestTcS :: TcS a -> TcS a Source

nestImplicTcS :: EvBindsVar -> TcLevel -> TcS a -> TcS a Source

recoverTcS :: TcS a -> TcS a -> TcS a Source

runTcPluginTcS :: TcPluginM a -> TcS a Source

addUsedRdrNamesTcS :: [RdrName] -> TcS () Source

deferTcSForAllEq :: Role -> CtLoc -> ([TyVar], TcType) -> ([TyVar], TcType) -> TcS EvTerm Source

panicTcS :: SDoc -> TcS a Source

traceTcS :: String -> SDoc -> TcS () Source

traceFireTcS :: CtEvidence -> SDoc -> TcS () Source

bumpStepCountTcS :: TcS () Source

csTraceTcS :: SDoc -> TcS () Source

wrapErrTcS :: TcM a -> TcS a Source

wrapWarnTcS :: TcM a -> TcS a Source

data XEvTerm Source

Constructors

XEvTerm |
Fields ev_preds :: [PredType] ev_comp :: [EvTerm] -> EvTerm ev_decomp :: EvTerm -> [EvTerm]

data Freshness Source

Constructors

Fresh |
Cached |

freshGoals :: [(CtEvidence, Freshness)] -> [CtEvidence] Source

isFresh :: Freshness -> Bool Source

newTcEvBinds :: TcS EvBindsVar Source

newWantedEvVar :: CtLoc -> TcPredType -> TcS (CtEvidence, Freshness) Source

newWantedEvVarNC :: CtLoc -> TcPredType -> TcS CtEvidence Source

setWantedTyBind :: TcTyVar -> TcType -> TcS () Source

reportUnifications :: TcS a -> TcS (Bool, a) Source

setEvBind :: EvVar -> EvTerm -> TcS () Source

newEvVar :: TcPredType -> TcS EvVar Source

newGivenEvVar :: CtLoc -> (TcPredType, EvTerm) -> TcS CtEvidence Source

newGivenEvVars :: CtLoc -> [(TcPredType, EvTerm)] -> TcS [CtEvidence] Source

newDerived :: CtLoc -> TcPredType -> TcS (Maybe CtEvidence) Source

emitNewDerived :: CtLoc -> TcPredType -> TcS () Source

instDFunConstraints :: CtLoc -> TcThetaType -> TcS [(CtEvidence, Freshness)] Source

getInstEnvs :: TcS InstEnvs Source

getFamInstEnvs :: TcS (FamInstEnv, FamInstEnv) Source

getTopEnv :: TcS HscEnv Source

getGblEnv :: TcS TcGblEnv Source

getTcEvBinds :: TcS EvBindsVar Source

getTcLevel :: TcS TcLevel Source

getTcEvBindsMap :: TcS EvBindMap Source

data InertSet Source

Constructors

IS |
Fields inert_cans :: InertCans inert_flat_cache :: FunEqMap (TcCoercion, TcType, CtFlavour) inert_solved_dicts :: DictMap CtEvidence

Instances

Outputable InertSet |

data InertCans Source

Constructors

IC |
Fields inert_eqs :: TyVarEnv EqualCtList inert_funeqs :: FunEqMap Ct inert_dicts :: DictMap Ct inert_irreds :: Cts inert_insols :: Cts

Instances

Outputable InertCans |

updInertTcS :: (InertSet -> InertSet) -> TcS () Source

updInertCans :: (InertCans -> InertCans) -> TcS () Source

updInertDicts :: (DictMap Ct -> DictMap Ct) -> TcS () Source

updInertIrreds :: (Cts -> Cts) -> TcS () Source

getNoGivenEqs :: TcLevel -> [TcTyVar] -> TcS Bool Source

setInertCans :: InertCans -> TcS () Source

getInertEqs :: TcS (TyVarEnv EqualCtList) Source

getInertCans :: TcS InertCans Source

emptyInert :: InertSet Source

getTcSInerts :: TcS InertSet Source

setTcSInerts :: InertSet -> TcS () Source

getUnsolvedInerts :: TcS (Bag Implication, Cts, Cts, Cts, Cts) Source

checkAllSolved :: TcS Bool Source

splitInertCans :: InertCans -> ([Ct], [Ct], [Ct]) Source

Extract the (given, derived, wanted) inert constraints

removeInertCts :: [Ct] -> InertCans -> InertCans Source

Remove inert constraints from the `InertCans`, for use when a typechecker plugin wishes to discard a given.

prepareInertsForImplications :: InertSet -> InertSet Source

addInertCan :: InertCans -> Ct -> InertCans Source

insertInertItemTcS :: Ct -> TcS () Source

insertFunEq :: FunEqMap a -> TyCon -> [Type] -> a -> FunEqMap a Source

emitInsoluble :: Ct -> TcS () Source

emitWorkNC :: [CtEvidence] -> TcS () Source

type EqualCtList = [Ct] Source

lookupInertDict :: InertCans -> CtLoc -> Class -> [Type] -> Maybe CtEvidence Source

findDictsByClass :: DictMap a -> Class -> Bag a Source

addDict :: DictMap a -> Class -> [Type] -> a -> DictMap a Source

addDictsByClass :: DictMap Ct -> Class -> Bag Ct -> DictMap Ct Source

delDict :: DictMap a -> Class -> [Type] -> DictMap a Source

partitionDicts :: (Ct -> Bool) -> DictMap Ct -> (Bag Ct, DictMap Ct) Source

findTyEqs :: InertCans -> TyVar -> EqualCtList Source

addSolvedDict :: CtEvidence -> Class -> [Type] -> TcS () Source

lookupSolvedDict :: InertSet -> CtLoc -> Class -> [Type] -> Maybe CtEvidence Source

lookupFlatCache :: TyCon -> [Type] -> TcS (Maybe (TcCoercion, TcType, CtFlavour)) Source

extendFlatCache :: TyCon -> [Type] -> (TcCoercion, TcType, CtFlavour) -> TcS () Source

newFlattenSkolem :: CtFlavour -> CtLoc -> TcType -> TcS (CtEvidence, TcTyVar) Source

updInertFunEqs :: (FunEqMap Ct -> FunEqMap Ct) -> TcS () Source

findFunEq :: FunEqMap a -> TyCon -> [Type] -> Maybe a Source

sizeFunEqMap :: FunEqMap a -> Int Source

findFunEqsByTyCon :: FunEqMap a -> TyCon -> [a] Source

findFunEqs :: FunEqMap a -> TyCon -> [Type] -> Maybe a Source

partitionFunEqs :: (Ct -> Bool) -> FunEqMap Ct -> ([Ct], FunEqMap Ct) Source

instDFunType :: DFunId -> [DFunInstType] -> TcS ([TcType], TcType) Source

newFlexiTcSTy :: Kind -> TcS TcType Source

instFlexiTcS :: [TKVar] -> TcS (TvSubst, [TcType]) Source

instFlexiTcSHelperTcS :: Name -> Kind -> TcS TcType Source

cloneMetaTyVar :: TcTyVar -> TcS TcTyVar Source

demoteUnfilledFmv :: TcTyVar -> TcS () Source

data TcLevel Source

Instances

Eq TcLevel |
Outputable TcLevel |

isTouchableMetaTyVarTcS :: TcTyVar -> TcS Bool Source

isFilledMetaTyVar_maybe :: TcTyVar -> TcS (Maybe Type) Source

isFilledMetaTyVar :: TcTyVar -> TcS Bool Source

zonkTyVarsAndFV :: TcTyVarSet -> TcS TcTyVarSet Source

zonkTcType :: TcType -> TcS TcType Source

zonkTcTyVar :: TcTyVar -> TcS TcType Source

zonkSimples :: Cts -> TcS Cts Source

newTcRef :: a -> TcS (TcRef a) Source

readTcRef :: TcRef a -> TcS a Source

updTcRef :: TcRef a -> (a -> a) -> TcS () Source

getDefaultInfo :: TcS ([Type], (Bool, Bool)) Source

getDynFlags :: HasDynFlags m => m DynFlags Source

getGlobalRdrEnvTcS :: TcS GlobalRdrEnv Source

matchFam :: TyCon -> [Type] -> TcS (Maybe (TcCoercion, TcType)) Source

matchFamTcM :: TyCon -> [Type] -> TcM (Maybe (TcCoercion, TcType)) Source

checkWellStagedDFun :: PredType -> DFunId -> CtLoc -> TcS () Source

pprEq :: TcType -> TcType -> SDoc Source