GHC.Tc.Solver

ghc-9.2.0.20210331: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.Tc.Solver

Synopsis

- data InferMode
  - = ApplyMR
  - | EagerDefaulting
  - | NoRestrictions
- simplifyInfer :: TcLevel -> InferMode -> [TcIdSigInst] -> [(Name, TcTauType)] -> WantedConstraints -> TcM ([TcTyVar], [EvVar], TcEvBinds, Bool)
- findInferredDiff :: TcThetaType -> TcThetaType -> TcM TcThetaType
- growThetaTyVars :: ThetaType -> TyCoVarSet -> TyCoVarSet
- simplifyAmbiguityCheck :: Type -> WantedConstraints -> TcM ()
- simplifyDefault :: ThetaType -> TcM Bool
- simplifyTop :: WantedConstraints -> TcM (Bag EvBind)
- simplifyTopImplic :: Bag Implication -> TcM ()
- simplifyInteractive :: WantedConstraints -> TcM (Bag EvBind)
- solveEqualities :: String -> TcM a -> TcM a
- pushLevelAndSolveEqualities :: SkolemInfo -> [TcTyVar] -> TcM a -> TcM a
- pushLevelAndSolveEqualitiesX :: String -> TcM a -> TcM (TcLevel, WantedConstraints, a)
- reportUnsolvedEqualities :: SkolemInfo -> [TcTyVar] -> TcLevel -> WantedConstraints -> TcM ()
- simplifyWantedsTcM :: [CtEvidence] -> TcM WantedConstraints
- tcCheckGivens :: InertSet -> Bag EvVar -> TcM (Maybe InertSet)
- tcCheckWanteds :: InertSet -> ThetaType -> TcM Bool
- tcNormalise :: InertSet -> Type -> TcM Type
- captureTopConstraints :: TcM a -> TcM (a, WantedConstraints)
- simplifyTopWanteds :: WantedConstraints -> TcS WantedConstraints
- promoteTyVarSet :: TcTyVarSet -> TcM Bool
- simplifyAndEmitFlatConstraints :: WantedConstraints -> TcM ()
- solveWanteds :: WantedConstraints -> TcS WantedConstraints
- solveWantedsAndDrop :: WantedConstraints -> TcS WantedConstraints
- approximateWC :: Bool -> WantedConstraints -> Cts
- runTcSDeriveds :: TcS a -> TcM a

# Documentation

data InferMode Source #

How should we choose which constraints to quantify over?

Constructors

ApplyMR | Apply the monomorphism restriction, never quantifying over any constraints
EagerDefaulting | See Note [TcRnExprMode] in GHC.Tc.Module, the :type +d case; this mode refuses to quantify over any defaultable constraint
NoRestrictions | Quantify over any constraint that satisfies `pickQuantifiablePreds`

#### Instances

Instances details

Outputable InferMode # |
Instance details Defined in GHC.Tc.Solver Methods ppr :: InferMode -> SDoc Source #

simplifyInfer :: TcLevel -> InferMode -> [TcIdSigInst] -> [(Name, TcTauType)] -> WantedConstraints -> TcM ([TcTyVar], [EvVar], TcEvBinds, Bool) Source #

findInferredDiff :: TcThetaType -> TcThetaType -> TcM TcThetaType Source #

growThetaTyVars :: ThetaType -> TyCoVarSet -> TyCoVarSet Source #

simplifyAmbiguityCheck :: Type -> WantedConstraints -> TcM () Source #

simplifyDefault :: ThetaType -> TcM Bool Source #

simplifyTop :: WantedConstraints -> TcM (Bag EvBind) Source #

simplifyTopImplic :: Bag Implication -> TcM () Source #

simplifyInteractive :: WantedConstraints -> TcM (Bag EvBind) Source #

solveEqualities :: String -> TcM a -> TcM a Source #

Type-check a thing that emits only equality constraints, solving any constraints we can and re-emitting constraints that we can't. Use this variant only when we'll get another crack at it later See Note [Failure in local type signatures]

Panics if we solve any non-equality constraints. (In runTCSEqualities we use an error thunk for the evidence bindings.)

pushLevelAndSolveEqualities :: SkolemInfo -> [TcTyVar] -> TcM a -> TcM a Source #

pushLevelAndSolveEqualitiesX :: String -> TcM a -> TcM (TcLevel, WantedConstraints, a) Source #

reportUnsolvedEqualities :: SkolemInfo -> [TcTyVar] -> TcLevel -> WantedConstraints -> TcM () Source #

simplifyWantedsTcM :: [CtEvidence] -> TcM WantedConstraints Source #

tcCheckGivens :: InertSet -> Bag EvVar -> TcM (Maybe InertSet) Source #

Return (Just new_inerts) if the Givens are satisfiable, Nothing if definitely contradictory

tcCheckWanteds :: InertSet -> ThetaType -> TcM Bool Source #

Return True if the Wanteds are soluble, False if not

tcNormalise :: InertSet -> Type -> TcM Type Source #

Normalise a type as much as possible using the given constraints. See `Note [tcNormalise]`.

captureTopConstraints :: TcM a -> TcM (a, WantedConstraints) Source #

simplifyTopWanteds :: WantedConstraints -> TcS WantedConstraints Source #

Simplify top-level constraints, but without reporting any unsolved constraints nor unsafe overlapping.

promoteTyVarSet :: TcTyVarSet -> TcM Bool Source #

simplifyAndEmitFlatConstraints :: WantedConstraints -> TcM () Source #

solveWanteds :: WantedConstraints -> TcS WantedConstraints Source #

solveWantedsAndDrop :: WantedConstraints -> TcS WantedConstraints Source #

approximateWC :: Bool -> WantedConstraints -> Cts Source #

runTcSDeriveds :: TcS a -> TcM a Source #

This variant of `runTcS` will keep solving, even when only Deriveds are left around. It also doesn't return any evidence, as callers won't need it.