TcSimplify

ghc-8.4.2: The GHC API

Safe Haskell | None
Language | Haskell2010

TcSimplify

Synopsis

- simplifyInfer :: TcLevel -> InferMode -> [TcIdSigInst] -> [(Name, TcTauType)] -> WantedConstraints -> TcM ([TcTyVar], [EvVar], TcEvBinds, Bool)
- data InferMode
  - = ApplyMR
  - | EagerDefaulting
  - | NoRestrictions
- growThetaTyVars :: ThetaType -> TyCoVarSet -> TyCoVarSet
- simplifyAmbiguityCheck :: Type -> WantedConstraints -> TcM ()
- simplifyDefault :: ThetaType -> TcM ()
- simplifyTop :: WantedConstraints -> TcM (Bag EvBind)
- simplifyTopImplic :: Bag Implication -> TcM ()
- captureTopConstraints :: TcM a -> TcM (a, WantedConstraints)
- simplifyInteractive :: WantedConstraints -> TcM (Bag EvBind)
- solveEqualities :: TcM a -> TcM a
- simplifyWantedsTcM :: [CtEvidence] -> TcM WantedConstraints
- tcCheckSatisfiability :: Bag EvVar -> TcM Bool
- tcSubsumes :: TcSigmaType -> TcSigmaType -> TcM Bool
- tcCheckHoleFit :: Cts -> TcSigmaType -> TcSigmaType -> TcM Bool
- solveWanteds :: WantedConstraints -> TcS WantedConstraints
- solveWantedsAndDrop :: WantedConstraints -> TcS WantedConstraints
- approximateWC :: Bool -> WantedConstraints -> Cts
- runTcSDeriveds :: TcS a -> TcM a

# Documentation

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

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 TcRnDriver, the :type +d case; this mode refuses to quantify over any defaultable constraint
NoRestrictions | Quantify over any constraint that satisfies TcType.pickQuantifiablePreds

Instances

Outputable InferMode Source # |
Instance details Defined in TcSimplify Methods ppr :: InferMode -> SDoc Source # pprPrec :: Rational -> InferMode -> SDoc Source #

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

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

simplifyDefault :: ThetaType -> TcM () Source #

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

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

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

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

solveEqualities :: TcM a -> TcM a Source #

Type-check a thing that emits only equality constraints, then solve those constraints. Fails outright if there is trouble.

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

tcCheckSatisfiability :: Bag EvVar -> TcM Bool Source #

tcSubsumes :: TcSigmaType -> TcSigmaType -> TcM Bool Source #

Reports whether first type (ty_a) subsumes the second type (ty_b), discarding any errors. Subsumption here means that the ty_b can fit into the ty_a, i.e. `tcSubsumes a b == True` if b is a subtype of a. N.B.: Make sure that the types contain all the constraints contained in any associated implications.

tcCheckHoleFit :: Cts -> TcSigmaType -> TcSigmaType -> TcM Bool Source #

A tcSubsumes which takes into account relevant constraints, to fix trac #14273. Make sure that the constraints are cloned, since the simplifier may perform unification

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.