TcValidity

ghc-8.8.4: The GHC API

Safe Haskell | None
Language | Haskell2010

TcValidity

Synopsis

- data Rank
- data UserTypeCtxt
  - = FunSigCtxt Name Bool
  - | InfSigCtxt Name
  - | ExprSigCtxt
  - | KindSigCtxt
  - | TypeAppCtxt
  - | ConArgCtxt Name
  - | TySynCtxt Name
  - | PatSynCtxt Name
  - | PatSigCtxt
  - | RuleSigCtxt Name
  - | ResSigCtxt
  - | ForSigCtxt Name
  - | DefaultDeclCtxt
  - | InstDeclCtxt Bool
  - | SpecInstCtxt
  - | ThBrackCtxt
  - | GenSigCtxt
  - | GhciCtxt Bool
  - | ClassSCCtxt Name
  - | SigmaCtxt
  - | DataTyCtxt Name
  - | DerivClauseCtxt
  - | TyVarBndrKindCtxt Name
  - | DataKindCtxt Name
  - | TySynKindCtxt Name
  - | TyFamResKindCtxt Name
- checkValidType :: UserTypeCtxt -> Type -> TcM ()
- checkValidMonoType :: Type -> TcM ()
- checkValidTheta :: UserTypeCtxt -> ThetaType -> TcM ()
- checkValidInstance :: UserTypeCtxt -> LHsSigType GhcRn -> Type -> TcM ()
- checkValidInstHead :: UserTypeCtxt -> Class -> [Type] -> TcM ()
- validDerivPred :: TyVarSet -> PredType -> Bool
- checkTySynRhs :: UserTypeCtxt -> TcType -> TcM ()
- checkValidCoAxiom :: CoAxiom Branched -> TcM ()
- checkValidCoAxBranch :: TyCon -> CoAxBranch -> TcM ()
- checkValidTyFamEqn :: TyCon -> [Var] -> [Type] -> Type -> TcM ()
- checkConsistentFamInst :: AssocInstInfo -> TyCon -> CoAxBranch -> TcM ()
- badATErr :: Name -> Name -> SDoc
- arityErr :: Outputable a => SDoc -> a -> Int -> Int -> SDoc
- checkValidTelescope :: TyCon -> TcM ()
- allDistinctTyVars :: TyVarSet -> [KindOrType] -> Bool

# Documentation

data Rank Source #

#### Instances

Instances details

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

data UserTypeCtxt Source #

Constructors

FunSigCtxt Name Bool |
InfSigCtxt Name |
ExprSigCtxt |
KindSigCtxt |
TypeAppCtxt |
ConArgCtxt Name |
TySynCtxt Name |
PatSynCtxt Name |
PatSigCtxt |
RuleSigCtxt Name |
ResSigCtxt |
ForSigCtxt Name |
DefaultDeclCtxt |
InstDeclCtxt Bool |
SpecInstCtxt |
ThBrackCtxt |
GenSigCtxt |
GhciCtxt Bool |
ClassSCCtxt Name |
SigmaCtxt |
DataTyCtxt Name |
DerivClauseCtxt |
TyVarBndrKindCtxt Name |
DataKindCtxt Name |
TySynKindCtxt Name |
TyFamResKindCtxt Name |

checkValidType :: UserTypeCtxt -> Type -> TcM () Source #

checkValidMonoType :: Type -> TcM () Source #

checkValidTheta :: UserTypeCtxt -> ThetaType -> TcM () Source #

checkValidInstance :: UserTypeCtxt -> LHsSigType GhcRn -> Type -> TcM () Source #

checkValidInstHead :: UserTypeCtxt -> Class -> [Type] -> TcM () Source #

validDerivPred :: TyVarSet -> PredType -> Bool Source #

checkTySynRhs :: UserTypeCtxt -> TcType -> TcM () Source #

checkValidCoAxiom :: CoAxiom Branched -> TcM () Source #

checkValidCoAxBranch :: TyCon -> CoAxBranch -> TcM () Source #

checkValidTyFamEqn Source #

Arguments

:: TyCon | of the type family
-> [Var] | Bound variables in the equation
-> [Type] | Type patterns
-> Type | Rhs
-> TcM () |

Do validity checks on a type family equation, including consistency with any enclosing class instance head, termination, and lack of polytypes.

checkConsistentFamInst Source #

Arguments

:: AssocInstInfo |
-> TyCon | Family tycon
-> CoAxBranch |
-> TcM () |

badATErr :: Name -> Name -> SDoc Source #

arityErr :: Outputable a => SDoc -> a -> Int -> Int -> SDoc Source #

checkValidTelescope :: TyCon -> TcM () Source #

Check a list of binders to see if they make a valid telescope. The key property we're checking for is scoping. For example: > data SameKind :: k -> k -> * > data X a k (b :: k) (c :: SameKind a b) Kind inference says that a's kind should be k. But that's impossible, because k isn't in scope when a is bound. This check has to come before general validity checking, because once we kind-generalise, this sort of problem is harder to spot (as we'll generalise over the unbound k in a's type.)

See Note [Generalisation for type constructors] in TcTyClsDecls for data type declarations and Note [Keeping scoped variables in order: Explicit] in TcHsType for foralls

allDistinctTyVars :: TyVarSet -> [KindOrType] -> Bool Source #