GHC.HsToCore.Pmc.Utils

ghc-9.10.0.20240328: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.HsToCore.Pmc.Utils

Description

Utility module for the pattern-match coverage checker.

Synopsis

- tracePm :: String -> SDoc -> DsM ()
- traceWhenFailPm :: String -> SDoc -> MaybeT DsM a -> MaybeT DsM a
- mkPmId :: Type -> DsM Id
- allPmCheckWarnings :: [WarningFlag]
- overlapping :: DynFlags -> HsMatchContext fn -> Bool
- exhaustive :: DynFlags -> HsMatchContext fn -> Bool
- redundantBang :: DynFlags -> Bool
- exhaustiveWarningFlag :: HsMatchContext fn -> Maybe WarningFlag
- isMatchContextPmChecked :: DynFlags -> Origin -> HsMatchContext fn -> Bool
- isMatchContextPmChecked_SinglePat :: DynFlags -> Origin -> HsMatchContext fn -> LPat GhcTc -> Bool
- needToRunPmCheck :: DynFlags -> Origin -> Bool

# Documentation

tracePm :: String -> SDoc -> DsM () Source #

traceWhenFailPm :: String -> SDoc -> MaybeT DsM a -> MaybeT DsM a Source #

mkPmId :: Type -> DsM Id Source #

Generate a fresh `Id` of a given type

allPmCheckWarnings :: [WarningFlag] Source #

All warning flags that need to run the pattern match checker.

overlapping :: DynFlags -> HsMatchContext fn -> Bool Source #

Check whether the redundancy checker should run (redundancy only)

exhaustive :: DynFlags -> HsMatchContext fn -> Bool Source #

Check whether the exhaustiveness checker should run (exhaustiveness only)

redundantBang :: DynFlags -> Bool Source #

Check whether unnecessary bangs should be warned about

exhaustiveWarningFlag :: HsMatchContext fn -> Maybe WarningFlag Source #

Denotes whether an exhaustiveness check is supported, and if so, via which `WarningFlag` it's controlled. Returns `Nothing` if check is not supported.

isMatchContextPmChecked :: DynFlags -> Origin -> HsMatchContext fn -> 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).

isMatchContextPmChecked_SinglePat :: DynFlags -> Origin -> HsMatchContext fn -> LPat GhcTc -> Bool Source #

Check whether exhaustivity checks are enabled for this `HsMatchContext`, when dealing with a single pattern (using the `matchSinglePatVar` function).

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.