Check

ghc-8.4.4: The GHC API

Safe Haskell | None
Language | Haskell2010

Check

Synopsis

- checkSingle :: DynFlags -> DsMatchContext -> Id -> Pat GhcTc -> DsM ()
- checkMatches :: DynFlags -> DsMatchContext -> [Id] -> [LMatch GhcTc (LHsExpr GhcTc)] -> DsM ()
- isAnyPmCheckEnabled :: DynFlags -> DsMatchContext -> Bool
- genCaseTmCs1 :: Maybe (LHsExpr GhcTc) -> [Id] -> Bag SimpleEq
- genCaseTmCs2 :: Maybe (LHsExpr GhcTc) -> [Pat GhcTc] -> [Id] -> DsM (Bag SimpleEq)
- pmIsClosedType :: Type -> Bool
- pmTopNormaliseType_maybe :: FamInstEnvs -> Type -> Maybe (Type, [DataCon], Type)

# Documentation

checkSingle :: DynFlags -> DsMatchContext -> Id -> Pat GhcTc -> DsM () #

Check a single pattern binding (let)

checkMatches :: DynFlags -> DsMatchContext -> [Id] -> [LMatch GhcTc (LHsExpr GhcTc)] -> DsM () #

Check a matchgroup (case, functions, etc.)

isAnyPmCheckEnabled :: DynFlags -> DsMatchContext -> Bool #

Check whether any part of pattern match checking is enabled (does not matter whether it is the redundancy check or the exhaustiveness check).

genCaseTmCs1 :: Maybe (LHsExpr GhcTc) -> [Id] -> Bag SimpleEq #

Generate a simple equality when checking a case expression: case x of { matches } When checking matches we record that (x ~ y) where y is the initial uncovered. All matches will have to satisfy this equality.

genCaseTmCs2 :: Maybe (LHsExpr GhcTc) -> [Pat GhcTc] -> [Id] -> DsM (Bag SimpleEq) #

Generate equalities when checking a case expression: case x of { p1 -> e1; ... pn -> en } When we go deeper to check e.g. e1 we record two equalities: (x ~ y), where y is the initial uncovered when checking (p1; .. ; pn) and (x ~ p1).

pmIsClosedType :: Type -> Bool #

Returns `True` if the argument `Type` is a fully saturated application of a closed type constructor.

Closed type constructors are those with a fixed right hand side, as opposed to e.g. associated types. These are of particular interest for pattern-match coverage checking, because GHC can exhaustively consider all possible forms that values of a closed type can take on.

Note that this function is intended to be used to check types of value-level patterns, so as a consequence, the `Type` supplied as an argument to this function should be of kind `Type`.

pmTopNormaliseType_maybe :: FamInstEnvs -> Type -> Maybe (Type, [DataCon], Type) #

Get rid of *outermost* (or toplevel) * type function redex * data family redex * newtypes

Behaves exactly like `topNormaliseType_maybe`, but instead of returning a coercion, it returns useful information for issuing pattern matching warnings. See Note [Type normalisation for EmptyCase] for details.