GHC.HsToCore.PmCheck

ghc-8.10.5: The GHC API

Safe Haskell | None
Language | Haskell2010

GHC.HsToCore.PmCheck

Synopsis

- checkSingle :: DynFlags -> DsMatchContext -> Id -> Pat GhcTc -> DsM ()
- checkMatches :: DynFlags -> DsMatchContext -> [Id] -> [LMatch GhcTc (LHsExpr GhcTc)] -> DsM ()
- checkGuardMatches :: HsMatchContext Name -> GRHSs GhcTc (LHsExpr GhcTc) -> DsM ()
- needToRunPmCheck :: DynFlags -> Origin -> Bool
- isMatchContextPmChecked :: DynFlags -> Origin -> HsMatchContext id -> Bool
- addTyCsDs :: Bag EvVar -> DsM a -> DsM a
- addScrutTmCs :: Maybe (LHsExpr GhcTc) -> [Id] -> DsM a -> DsM a
- addPatTmCs :: [Pat GhcTc] -> [Id] -> DsM a -> DsM a

# Documentation

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

Check a single pattern binding (let)

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

Check a matchgroup (case, functions, etc.)

checkGuardMatches :: HsMatchContext Name -> GRHSs GhcTc (LHsExpr GhcTc) -> DsM () Source #

Exhaustive for guard matches, is used for guards in pattern bindings and in `MultiIf` expressions.

needToRunPmCheck :: DynFlags -> Origin -> Bool Source #

Return True when any of the pattern match warnings (`allPmCheckWarnings`) are enabled, in which case we need to run the pattern match checker.

isMatchContextPmChecked :: DynFlags -> Origin -> HsMatchContext id -> Bool Source #

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

addTyCsDs :: Bag EvVar -> DsM a -> DsM a Source #

Add in-scope type constraints

addScrutTmCs :: Maybe (LHsExpr GhcTc) -> [Id] -> DsM a -> DsM a Source #

Add equalities for the scrutinee to the local `DsM` environment when checking a case expression: case e of x { matches } When checking matches we record that (x ~ e) where x is the initial uncovered. All matches will have to satisfy this equality.

addPatTmCs :: [Pat GhcTc] -> [Id] -> DsM a -> DsM a Source #

Add equalities to the local `DsM` environment when checking the RHS of a case expression: case e of x { p1 -> e1; ... pn -> en } When we go deeper to check e.g. e1 we record (x ~ p1).