GHC.Tc.Gen.Pat

ghc-9.10.0.20240328: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Tc.Gen.Pat

Description

Typechecking patterns

Synopsis

- tcLetPat :: (Name -> Maybe TcId) -> LetBndrSpec -> LPat GhcRn -> Scaled ExpSigmaTypeFRR -> TcM a -> TcM (LPat GhcTc, a)
- newLetBndr :: LetBndrSpec -> Name -> Mult -> TcType -> TcM TcId
- data LetBndrSpec
  - = LetLclBndr
  - | LetGblBndr TcPragEnv
- tcCheckPat :: HsMatchContextRn -> LPat GhcRn -> Scaled TcSigmaTypeFRR -> TcM a -> TcM (LPat GhcTc, a)
- tcCheckPat_O :: HsMatchContextRn -> CtOrigin -> LPat GhcRn -> Scaled TcSigmaTypeFRR -> TcM a -> TcM (LPat GhcTc, a)
- tcInferPat :: FixedRuntimeRepContext -> HsMatchContextRn -> LPat GhcRn -> TcM a -> TcM ((LPat GhcTc, a), TcSigmaTypeFRR)
- tcMatchPats :: HsMatchContextRn -> [LArgPat GhcRn] -> [ExpPatType] -> TcM a -> TcM ([LArgPat GhcTc], a)
- addDataConStupidTheta :: DataCon -> [TcType] -> TcM ()
- isIrrefutableHsPatRnTcM :: Bool -> LPat GhcRn -> TcM Bool

# Documentation

tcLetPat :: (Name -> Maybe TcId) -> LetBndrSpec -> LPat GhcRn -> Scaled ExpSigmaTypeFRR -> TcM a -> TcM (LPat GhcTc, a) Source #

newLetBndr :: LetBndrSpec -> Name -> Mult -> TcType -> TcM TcId Source #

data LetBndrSpec Source #

Constructors

LetLclBndr |
LetGblBndr TcPragEnv |

#### Instances

Instances details

Outputable LetBndrSpec Source # |
Instance details Defined in GHC.Tc.Gen.Pat Methods ppr :: LetBndrSpec -> SDoc Source #

tcCheckPat :: HsMatchContextRn -> LPat GhcRn -> Scaled TcSigmaTypeFRR -> TcM a -> TcM (LPat GhcTc, a) Source #

tcCheckPat_O Source #

Arguments

:: HsMatchContextRn |
-> CtOrigin | origin to use if the type needs inst'ing
-> LPat GhcRn |
-> Scaled TcSigmaTypeFRR |
-> TcM a |
-> TcM (LPat GhcTc, a) |

A variant of `tcPat` that takes a custom origin

tcInferPat :: FixedRuntimeRepContext -> HsMatchContextRn -> LPat GhcRn -> TcM a -> TcM ((LPat GhcTc, a), TcSigmaTypeFRR) Source #

tcMatchPats Source #

Arguments

:: HsMatchContextRn |
-> [LArgPat GhcRn] | patterns
-> [ExpPatType] | types of the patterns
-> TcM a | checker for the body
-> TcM ([LArgPat GhcTc], a) |

addDataConStupidTheta :: DataCon -> [TcType] -> TcM () Source #

isIrrefutableHsPatRnTcM :: Bool -> LPat GhcRn -> TcM Bool Source #

Very similar to GHC.Tc.Pat.isIrrefutableHsPat, but doesn't typecheck the pattern It does depend on the type checker monad (`TcM`) however as we need to check ConPat case in more detail. Specifically, we call `tcLookupGlobal` to obtain constructor details from global packages for a comprehensive irrefutability check and avoid false negatives. (testcase pattern-fails.hs)