ghc-7.8.4: 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

Constructors

WorkList |

Fields

wl_eqs :: [Ct]
wl_funeqs :: Deque Ct
wl_rest :: [Ct]

Instances

Outputable WorkList |

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

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

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

Instances

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

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

Constructors

XEvTerm |

Fields

ev_preds :: [PredType]
ev_comp :: [EvTerm] -> EvTerm
ev_decomp :: EvTerm -> [EvTerm]

data MaybeNew

Constructors

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

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)

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

Constructors

DQ [a] [a] |

Instances

Outputable a => Outputable (Deque a) |

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

emptyDeque :: Deque a

data InertSet

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

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])

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

Instances

Outputable 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