TcSimplify

ghc-8.6.3: The GHC API

Safe Haskell | None
Language | Haskell2010

TcSimplify

Synopsis

- simplifyInfer :: TcLevel -> InferMode -> [TcIdSigInst] -> [(Name, TcTauType)] -> WantedConstraints -> TcM ([TcTyVar], [EvVar], TcEvBinds, WantedConstraints, 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
- solveLocalEqualities :: TcM a -> TcM a
- simplifyWantedsTcM :: [CtEvidence] -> TcM WantedConstraints
- tcCheckSatisfiability :: Bag EvVar -> TcM Bool
- simpl_top :: WantedConstraints -> TcS WantedConstraints
- promoteTyVar :: TcTyVar -> TcM Bool
- promoteTyVarSet :: TcTyVarSet -> 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, WantedConstraints, Bool) #

data InferMode #

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 # |
Instance details Defined in TcSimplify Methods ppr :: InferMode -> SDoc # pprPrec :: Rational -> InferMode -> SDoc #

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 #

Type-check a thing that emits only equality constraints, then solve those constraints. Fails outright if there is trouble. Use this if you're not going to get another crack at solving (because, e.g., you're checking a datatype declaration)

solveLocalEqualities :: TcM a -> TcM a #

Type-check a thing that emits only equality constraints, solving any constraints we can and re-emitting constraints that we can't. The thing_inside should generally bump the TcLevel to make sure that this run of the solver doesn't affect anything lying around.

simplifyWantedsTcM :: [CtEvidence] -> TcM WantedConstraints #

tcCheckSatisfiability :: Bag EvVar -> TcM Bool #

simpl_top :: WantedConstraints -> TcS WantedConstraints #

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

promoteTyVar :: TcTyVar -> TcM Bool #

promoteTyVarSet :: TcTyVarSet -> TcM Bool #

solveWanteds :: WantedConstraints -> TcS WantedConstraints #

solveWantedsAndDrop :: WantedConstraints -> TcS WantedConstraints #

approximateWC :: Bool -> WantedConstraints -> Cts #

runTcSDeriveds :: TcS a -> TcM a #

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.