ghc-lib-9.8.2.20240223: The GHC API, decoupled from GHC versions
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.Tc.Solver.Monad

Description

Monadic definitions for the constraint solver

Synopsis

Documentation

data TcS a Source #

Instances

Instances details
MonadFail TcS Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

Methods

fail :: String -> TcS a #

MonadFix TcS Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

Methods

mfix :: (a -> TcS a) -> TcS a #

MonadIO TcS Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

Methods

liftIO :: IO a -> TcS a #

Applicative TcS Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

Methods

pure :: a -> TcS a #

(<*>) :: TcS (a -> b) -> TcS a -> TcS b #

liftA2 :: (a -> b -> c) -> TcS a -> TcS b -> TcS c #

(*>) :: TcS a -> TcS b -> TcS b #

(<*) :: TcS a -> TcS b -> TcS a #

Functor TcS Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

Methods

fmap :: (a -> b) -> TcS a -> TcS b #

(<$) :: a -> TcS b -> TcS a #

Monad TcS Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

Methods

(>>=) :: TcS a -> (a -> TcS b) -> TcS b #

(>>) :: TcS a -> TcS b -> TcS b #

return :: a -> TcS a #

HasDynFlags TcS Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

MonadThings TcS Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

MonadUnique TcS Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

HasModule TcS Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

Methods

getModule :: TcS Module #

runTcSEarlyAbort :: TcS a -> TcM a Source #

This variant of runTcS will immediately fail upon encountering an insoluble ct. See Note [Speeding up valid hole-fits]. Its one usage site does not need the ev_binds, so we do not return them.

runTcSInerts :: InertSet -> TcS a -> TcM (a, InertSet) Source #

A variant of runTcS that takes and returns an InertSet for later resumption of the TcS session.

wrapTcS :: TcM a -> TcS a Source #

ctLocWarnTcS :: CtLoc -> TcRnMessage -> TcS () Source #

Emit a warning within the TcS monad at the location given by the CtLoc.

runTcSEqualities :: TcS a -> TcM a Source #

This can deal only with equality constraints.

nestTcS :: TcS a -> TcS a Source #

data ClsInstResult Source #

Instances

Instances details
Outputable ClsInstResult Source # 
Instance details

Defined in GHC.Tc.Instance.Class

Methods

ppr :: ClsInstResult -> SDoc #

data QCInst #

Instances

Instances details
Outputable QCInst 
Instance details

Defined in GHC.Tc.Types.Constraint

Methods

ppr :: QCInst -> SDoc #

data StopOrContinue a Source #

Instances

Instances details
Functor StopOrContinue Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

Methods

fmap :: (a -> b) -> StopOrContinue a -> StopOrContinue b #

(<$) :: a -> StopOrContinue b -> StopOrContinue a #

Outputable a => Outputable (StopOrContinue a) Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

Methods

ppr :: StopOrContinue a -> SDoc #

newtype SolverStage a Source #

Constructors

Stage 

Instances

Instances details
Applicative SolverStage Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

Methods

pure :: a -> SolverStage a #

(<*>) :: SolverStage (a -> b) -> SolverStage a -> SolverStage b #

liftA2 :: (a -> b -> c) -> SolverStage a -> SolverStage b -> SolverStage c #

(*>) :: SolverStage a -> SolverStage b -> SolverStage b #

(<*) :: SolverStage a -> SolverStage b -> SolverStage a #

Functor SolverStage Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

Methods

fmap :: (a -> b) -> SolverStage a -> SolverStage b #

(<$) :: a -> SolverStage b -> SolverStage a #

Monad SolverStage Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

Methods

(>>=) :: SolverStage a -> (a -> SolverStage b) -> SolverStage b #

(>>) :: SolverStage a -> SolverStage b -> SolverStage b #

return :: a -> SolverStage a #

newWantedEq :: CtLoc -> RewriterSet -> Role -> TcType -> TcType -> TcS (CtEvidence, Coercion) Source #

Create a new Wanted constraint holding a coercion hole for an equality between the two types at the given Role.

emitNewWantedEq :: CtLoc -> RewriterSet -> Role -> TcType -> TcType -> TcS Coercion Source #

Emit a new Wanted equality into the work-list

newWanted :: CtLoc -> RewriterSet -> PredType -> TcS MaybeNew Source #

Create a new Wanted constraint, potentially looking up non-equality constraints in the cache instead of creating a new one from scratch.

Deals with both equality and non-equality constraints.

newWantedNC :: CtLoc -> RewriterSet -> PredType -> TcS CtEvidence Source #

Create a new Wanted constraint.

Deals with both equality and non-equality constraints.

Does not attempt to re-use non-equality constraints that already exist in the inert set.

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

Create a new Wanted constraint holding an evidence variable.

Don't use this for equality constraints: use newWantedEq instead.

newBoundEvVarId :: TcPredType -> EvTerm -> TcS EvVar Source #

Make a new Id of the given type, bound (in the monad's EvBinds) to the given term

setWantedEq :: HasDebugCallStack => TcEvDest -> Coercion -> TcS () Source #

Equalities only

setWantedEvTerm :: TcEvDest -> Canonical -> EvTerm -> TcS () Source #

Good for both equalities and non-equalities

checkReductionDepth Source #

Arguments

:: CtLoc 
-> TcType

type being reduced

-> TcS () 

Checks if the depth of the given location is too much. Fails if it's too big, with an appropriate error message.

getInertInsols :: TcS Cts Source #

Retrieves all insoluble constraints from the inert set, specifically including Given constraints.

This consists of:

  • insoluble equalities, such as Int ~# Bool;
  • constraints that are top-level custom type errors, of the form TypeError msg, but not constraints such as Eq (TypeError msg) in which the type error is nested;
  • unsatisfiable constraints, of the form Unsatisfiable msg.

The inclusion of Givens is important for pattern match warnings, as we want to consider a pattern match that introduces insoluble Givens to be redundant (see Note [Pattern match warnings with insoluble Givens] in GHC.Tc.Solver).

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

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

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

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

Look up a dictionary inert.

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

Look up a solved inert.

foldIrreds :: (IrredCt -> b -> b) -> InertIrreds -> b -> b #

lookupFamAppInert :: (CtFlavourRole -> Bool) -> TyCon -> [Type] -> TcS (Maybe (Reduction, CtFlavourRole)) Source #

Looks up a family application in the inerts.

data TcLevel #

Instances

Instances details
Outputable TcLevel 
Instance details

Defined in GHC.Tc.Utils.TcType

Methods

ppr :: TcLevel -> SDoc #

Eq TcLevel 
Instance details

Defined in GHC.Tc.Utils.TcType

Methods

(==) :: TcLevel -> TcLevel -> Bool #

(/=) :: TcLevel -> TcLevel -> Bool #

Ord TcLevel 
Instance details

Defined in GHC.Tc.Utils.TcType

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

writeTcRef :: TcRef a -> a -> TcS () Source #

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