TcSMonad

ghc-7.8.3: The GHC API

Safe Haskell | None
Language | Haskell98

TcSMonad

Synopsis

- data WorkList = WorkList {
  - wl_eqs :: [Ct]
  - wl_funeqs :: Deque Ct
  - wl_rest :: [Ct]
  }
- isEmptyWorkList :: WorkList -> Bool
- emptyWorkList :: WorkList
- workListFromEq :: Ct -> WorkList
- workListFromNonEq :: Ct -> WorkList
- workListFromCt :: Ct -> WorkList
- extendWorkListEq :: Ct -> WorkList -> WorkList
- extendWorkListFunEq :: Ct -> WorkList -> WorkList
- extendWorkListNonEq :: Ct -> WorkList -> WorkList
- extendWorkListCt :: Ct -> WorkList -> WorkList
- extendWorkListCts :: [Ct] -> WorkList -> WorkList
- extendWorkListEqs :: [Ct] -> WorkList -> WorkList
- appendWorkList :: WorkList -> WorkList -> WorkList
- selectWorkItem :: WorkList -> (Maybe Ct, WorkList)
- withWorkList :: Cts -> TcS () -> TcS (Bag Implication)
- workListSize :: WorkList -> Int
- updWorkListTcS :: (WorkList -> WorkList) -> TcS ()
- updWorkListTcS_return :: (WorkList -> (a, WorkList)) -> TcS a
- updTcSImplics :: (Bag Implication -> Bag Implication) -> TcS ()
- data Ct
  - = CDictCan {
    - cc_ev :: CtEvidence
    - cc_class :: Class
    - cc_tyargs :: [Xi]
    }
  - | CIrredEvCan {
    - cc_ev :: CtEvidence
    }
  - | CTyEqCan {
    - cc_ev :: CtEvidence
    - cc_tyvar :: TcTyVar
    - cc_rhs :: Xi
    }
  - | CFunEqCan {
    - cc_ev :: CtEvidence
    - cc_fun :: TyCon
    - cc_tyargs :: [Xi]
    - cc_rhs :: Xi
    }
  - | CNonCanonical {
    - cc_ev :: CtEvidence
    }
  - | CHoleCan {
    - cc_ev :: CtEvidence
    - cc_occ :: OccName
    }
- type Xi = Type
- tyVarsOfCt :: Ct -> TcTyVarSet
- tyVarsOfCts :: Cts -> TcTyVarSet
- emitInsoluble :: Ct -> TcS ()
- isWanted :: CtEvidence -> Bool
- isDerived :: CtEvidence -> Bool
- isGivenCt :: Ct -> Bool
- isWantedCt :: Ct -> Bool
- isDerivedCt :: Ct -> Bool
- canRewrite :: CtEvidence -> CtEvidence -> Bool
- mkGivenLoc :: SkolemInfo -> TcLclEnv -> CtLoc
- data TcS a
- runTcS :: TcS a -> TcM (a, Bag EvBind)
- runTcSWithEvBinds :: EvBindsVar -> TcS a -> TcM a
- failTcS :: SDoc -> TcS a
- panicTcS :: SDoc -> TcS a
- traceTcS :: String -> SDoc -> TcS ()
- traceFireTcS :: Ct -> SDoc -> TcS ()
- bumpStepCountTcS :: TcS ()
- tryTcS :: TcS a -> TcS a
- nestTcS :: TcS a -> TcS a
- nestImplicTcS :: EvBindsVar -> Untouchables -> InertSet -> TcS a -> TcS a
- recoverTcS :: TcS a -> TcS a -> TcS a
- wrapErrTcS :: TcM a -> TcS a
- wrapWarnTcS :: TcM a -> TcS a
- addSolvedDict :: CtEvidence -> Class -> [Type] -> TcS ()
- addSolvedFunEq :: TyCon -> [TcType] -> CtEvidence -> TcType -> TcS ()
- getGivenInfo :: TcS a -> TcS (Bool, [TcTyVar], a)
- addUsedRdrNamesTcS :: [RdrName] -> TcS ()
- deferTcSForAllEq :: Role -> CtLoc -> ([TyVar], TcType) -> ([TyVar], TcType) -> TcS EvTerm
- setEvBind :: EvVar -> EvTerm -> TcS ()
- data XEvTerm = XEvTerm {
  - ev_preds :: [PredType]
  - ev_comp :: [EvTerm] -> EvTerm
  - ev_decomp :: EvTerm -> [EvTerm]
  }
- data MaybeNew
  - = Fresh CtEvidence
  - | Cached EvTerm
- isFresh :: MaybeNew -> Bool
- freshGoal :: MaybeNew -> Maybe CtEvidence
- freshGoals :: [MaybeNew] -> [CtEvidence]
- getEvTerm :: MaybeNew -> EvTerm
- getEvTerms :: [MaybeNew] -> [EvTerm]
- xCtEvidence :: CtEvidence -> XEvTerm -> TcS [CtEvidence]
- rewriteEvidence :: CtEvidence -> TcPredType -> TcCoercion -> TcS (Maybe CtEvidence)
- rewriteEqEvidence :: CtEvidence -> SwapFlag -> TcType -> TcType -> TcCoercion -> TcCoercion -> TcS (Maybe CtEvidence)
- maybeSym :: SwapFlag -> TcCoercion -> TcCoercion
- newWantedEvVar :: CtLoc -> TcPredType -> TcS MaybeNew
- newWantedEvVarNC :: CtLoc -> TcPredType -> TcS CtEvidence
- newWantedEvVarNonrec :: CtLoc -> TcPredType -> TcS MaybeNew
- newDerived :: CtLoc -> TcPredType -> TcS (Maybe CtEvidence)
- instDFunConstraints :: CtLoc -> TcThetaType -> TcS [MaybeNew]
- setWantedTyBind :: TcTyVar -> TcType -> TcS ()
- reportUnifications :: TcS a -> TcS (Bool, a)
- getInstEnvs :: TcS (InstEnv, InstEnv)
- getFamInstEnvs :: TcS (FamInstEnv, FamInstEnv)
- getTopEnv :: TcS HscEnv
- getGblEnv :: TcS TcGblEnv
- getTcEvBinds :: TcS EvBindsVar
- getUntouchables :: TcS Untouchables
- getTcEvBindsMap :: TcS EvBindMap
- getTcSTyBindsMap :: TcS (TyVarEnv (TcTyVar, TcType))
- lookupFlatEqn :: TyCon -> [Type] -> TcS (Maybe (CtEvidence, TcType))
- newFlattenSkolem :: CtEvidence -> TcType -> TcS (CtEvidence, TcType)
- data Deque a = DQ [a] [a]
- insertDeque :: a -> Deque a -> Deque a
- emptyDeque :: Deque a
- data InertSet = IS {
  - inert_cans :: InertCans
  - inert_flat_cache :: FunEqMap (CtEvidence, TcType)
  - inert_fsks :: [TcTyVar]
  - inert_solved_funeqs :: FunEqMap (CtEvidence, TcType)
  - inert_solved_dicts :: DictMap CtEvidence
  }
- data InertCans = IC {
  - inert_eqs :: TyVarEnv EqualCtList
  - inert_funeqs :: FunEqMap EqualCtList
  - inert_dicts :: DictMap Ct
  - inert_irreds :: Cts
  - inert_insols :: Cts
  - inert_no_eqs :: !Bool
  }
- getInertEqs :: TcS (TyVarEnv [Ct])
- emptyInert :: InertSet
- getTcSInerts :: TcS InertSet
- setTcSInerts :: InertSet -> TcS ()
- getInertUnsolved :: TcS (Cts, Cts)
- checkAllSolved :: TcS Bool
- prepareInertsForImplications :: InertSet -> InertSet
- addInertCan :: InertCans -> Ct -> InertCans
- insertInertItemTcS :: Ct -> TcS ()
- type EqualCtList = [Ct]
- lookupSolvedDict :: InertSet -> Class -> [Type] -> Maybe CtEvidence
- extendFlatCache :: TyCon -> [Type] -> CtEvidence -> TcType -> TcS ()
- findFunEq :: FunEqMap a -> TyCon -> [Type] -> Maybe a
- findTyEqs :: TyEqMap EqualCtList -> TyVar -> EqualCtList
- findDict :: DictMap a -> Class -> [Type] -> Maybe a
- 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)
- findFunEqsByTyCon :: FunEqMap [a] -> TyCon -> [a]
- findFunEqs :: FunEqMap [a] -> TyCon -> [Type] -> [a]
- addFunEq :: FunEqMap EqualCtList -> TyCon -> [Type] -> Ct -> FunEqMap EqualCtList
- replaceFunEqs :: FunEqMap EqualCtList -> TyCon -> [Type] -> Ct -> FunEqMap EqualCtList
- partitionFunEqs :: (Ct -> Bool) -> FunEqMap EqualCtList -> (Bag Ct, FunEqMap EqualCtList)
- instDFunType :: DFunId -> [DFunInstType] -> TcS ([TcType], TcType)
- newFlexiTcSTy :: Kind -> TcS TcType
- instFlexiTcS :: [TKVar] -> TcS (TvSubst, [TcType])
- instFlexiTcSHelperTcS :: Name -> Kind -> TcS TcType
- cloneMetaTyVar :: TcTyVar -> TcS TcTyVar
- data Untouchables
- isTouchableMetaTyVarTcS :: TcTyVar -> TcS Bool
- isFilledMetaTyVar_maybe :: TcTyVar -> TcS (Maybe Type)
- zonkTyVarsAndFV :: TcTyVarSet -> TcS TcTyVarSet
- getDefaultInfo :: TcS ([Type], (Bool, Bool))
- getDynFlags :: HasDynFlags m => m DynFlags
- getGlobalRdrEnvTcS :: TcS GlobalRdrEnv
- matchFam :: TyCon -> [Type] -> TcS (Maybe (TcCoercion, TcType))
- matchOpenFam :: TyCon -> [Type] -> TcS (Maybe FamInstMatch)
- checkWellStagedDFun :: PredType -> DFunId -> CtLoc -> TcS ()
- pprEq :: TcType -> TcType -> SDoc

# Documentation

data WorkList Source

Constructors

WorkList |
Fields wl_eqs :: [Ct] wl_funeqs :: Deque Ct wl_rest :: [Ct]

Instances

Outputable WorkList |

isEmptyWorkList :: WorkList -> Bool Source

emptyWorkList :: WorkList Source

workListFromEq :: Ct -> WorkList Source

workListFromNonEq :: Ct -> WorkList Source

workListFromCt :: Ct -> WorkList Source

extendWorkListEq :: Ct -> WorkList -> WorkList Source

extendWorkListFunEq :: Ct -> WorkList -> WorkList Source

extendWorkListNonEq :: Ct -> WorkList -> WorkList Source

extendWorkListCt :: Ct -> WorkList -> WorkList Source

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

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

appendWorkList :: WorkList -> WorkList -> WorkList Source

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

withWorkList :: Cts -> TcS () -> TcS (Bag Implication) Source

workListSize :: WorkList -> Int Source

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

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

updTcSImplics :: (Bag Implication -> Bag Implication) -> TcS () Source

data Ct Source

Constructors

CDictCan |
Fields cc_ev :: CtEvidence cc_class :: Class cc_tyargs :: [Xi]
CIrredEvCan |
Fields cc_ev :: CtEvidence
CTyEqCan |
Fields cc_ev :: CtEvidence cc_tyvar :: TcTyVar cc_rhs :: Xi
CFunEqCan |
Fields cc_ev :: CtEvidence cc_fun :: TyCon cc_tyargs :: [Xi] cc_rhs :: Xi
CNonCanonical |
Fields cc_ev :: CtEvidence
CHoleCan |
Fields cc_ev :: CtEvidence cc_occ :: OccName

Instances

Outputable Ct |

type Xi = Type Source

tyVarsOfCt :: Ct -> TcTyVarSet Source

tyVarsOfCts :: Cts -> TcTyVarSet Source

emitInsoluble :: Ct -> TcS () Source

isWanted :: CtEvidence -> Bool Source

isDerived :: CtEvidence -> Bool Source

isGivenCt :: Ct -> Bool Source

isWantedCt :: Ct -> Bool Source

isDerivedCt :: Ct -> Bool Source

canRewrite :: CtEvidence -> CtEvidence -> Bool Source

mkGivenLoc :: SkolemInfo -> TcLclEnv -> CtLoc 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

panicTcS :: SDoc -> TcS a Source

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

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

bumpStepCountTcS :: TcS () Source

tryTcS :: TcS a -> TcS a Source

nestTcS :: TcS a -> TcS a Source

nestImplicTcS :: EvBindsVar -> Untouchables -> InertSet -> TcS a -> TcS a Source

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

wrapErrTcS :: TcM a -> TcS a Source

wrapWarnTcS :: TcM a -> TcS a Source

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

addSolvedFunEq :: TyCon -> [TcType] -> CtEvidence -> TcType -> TcS () Source

getGivenInfo :: TcS a -> TcS (Bool, [TcTyVar], a) Source

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

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

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

data XEvTerm Source

Constructors

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

data MaybeNew Source

Constructors

Fresh CtEvidence |
Cached EvTerm |

isFresh :: MaybeNew -> Bool Source

freshGoal :: MaybeNew -> Maybe CtEvidence Source

freshGoals :: [MaybeNew] -> [CtEvidence] Source

getEvTerm :: MaybeNew -> EvTerm Source

getEvTerms :: [MaybeNew] -> [EvTerm] Source

xCtEvidence :: CtEvidence -> XEvTerm -> TcS [CtEvidence] Source

rewriteEvidence :: CtEvidence -> TcPredType -> TcCoercion -> TcS (Maybe CtEvidence) Source

rewriteEqEvidence :: CtEvidence -> SwapFlag -> TcType -> TcType -> TcCoercion -> TcCoercion -> TcS (Maybe CtEvidence) Source

maybeSym :: SwapFlag -> TcCoercion -> TcCoercion Source

newWantedEvVar :: CtLoc -> TcPredType -> TcS MaybeNew Source

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

newWantedEvVarNonrec :: CtLoc -> TcPredType -> TcS MaybeNew Source

Variant of newWantedEvVar that has a lower bound on the depth of the result (see Note [Preventing recursive dictionaries])

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

instDFunConstraints :: CtLoc -> TcThetaType -> TcS [MaybeNew] Source

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

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

getInstEnvs :: TcS (InstEnv, InstEnv) Source

getFamInstEnvs :: TcS (FamInstEnv, FamInstEnv) Source

getTopEnv :: TcS HscEnv Source

getGblEnv :: TcS TcGblEnv Source

getTcEvBinds :: TcS EvBindsVar Source

getUntouchables :: TcS Untouchables Source

getTcEvBindsMap :: TcS EvBindMap Source

getTcSTyBindsMap :: TcS (TyVarEnv (TcTyVar, TcType)) Source

lookupFlatEqn :: TyCon -> [Type] -> TcS (Maybe (CtEvidence, TcType)) Source

newFlattenSkolem :: CtEvidence -> TcType -> TcS (CtEvidence, TcType) Source

data Deque a Source

Constructors

DQ [a] [a] |

Instances

Outputable a => Outputable (Deque a) |

insertDeque :: a -> Deque a -> Deque a Source

emptyDeque :: Deque a Source

data InertSet Source

Constructors

IS |
Fields inert_cans :: InertCans inert_flat_cache :: FunEqMap (CtEvidence, TcType) inert_fsks :: [TcTyVar] inert_solved_funeqs :: FunEqMap (CtEvidence, TcType) inert_solved_dicts :: DictMap CtEvidence

Instances

Outputable InertSet |

data InertCans Source

Constructors

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

Instances

Outputable InertCans |

getInertEqs :: TcS (TyVarEnv [Ct]) Source

emptyInert :: InertSet Source

getTcSInerts :: TcS InertSet Source

setTcSInerts :: InertSet -> TcS () Source

getInertUnsolved :: TcS (Cts, Cts) Source

checkAllSolved :: TcS Bool Source

prepareInertsForImplications :: InertSet -> InertSet Source

addInertCan :: InertCans -> Ct -> InertCans Source

insertInertItemTcS :: Ct -> TcS () Source

type EqualCtList = [Ct] Source

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

extendFlatCache :: TyCon -> [Type] -> CtEvidence -> TcType -> TcS () Source

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

findTyEqs :: TyEqMap EqualCtList -> TyVar -> EqualCtList Source

findDict :: DictMap a -> Class -> [Type] -> Maybe a 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

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

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

addFunEq :: FunEqMap EqualCtList -> TyCon -> [Type] -> Ct -> FunEqMap EqualCtList Source

replaceFunEqs :: FunEqMap EqualCtList -> TyCon -> [Type] -> Ct -> FunEqMap EqualCtList Source

partitionFunEqs :: (Ct -> Bool) -> FunEqMap EqualCtList -> (Bag Ct, FunEqMap EqualCtList) 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

data Untouchables Source

Instances

Outputable Untouchables |

isTouchableMetaTyVarTcS :: TcTyVar -> TcS Bool Source

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

zonkTyVarsAndFV :: TcTyVarSet -> TcS TcTyVarSet 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

matchOpenFam :: TyCon -> [Type] -> TcS (Maybe FamInstMatch) Source

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

pprEq :: TcType -> TcType -> SDoc Source