ghc-9.10.3: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Tc.Gen.Match

Description

Typecheck some `Matches`

Synopsis

- tcFunBindMatches :: UserTypeCtxt -> Name -> Mult -> MatchGroup GhcRn (LHsExpr GhcRn) -> [ExpPatType] -> ExpRhoType -> TcM (HsWrapper, MatchGroup GhcTc (LHsExpr GhcTc))
- tcCaseMatches :: (AnnoBody body, Outputable (body GhcTc)) => HsMatchContextRn -> TcMatchAltChecker body -> Scaled TcSigmaTypeFRR -> MatchGroup GhcRn (LocatedA (body GhcRn)) -> ExpRhoType -> TcM (HsWrapper, MatchGroup GhcTc (LocatedA (body GhcTc)))
- tcLambdaMatches :: HsExpr GhcRn -> HsLamVariant -> MatchGroup GhcRn (LHsExpr GhcRn) -> [ExpPatType] -> ExpSigmaType -> TcM (HsWrapper, MatchGroup GhcTc (LHsExpr GhcTc))
- tcGRHSList :: AnnoBody body => HsMatchContextRn -> TcMatchAltChecker body -> [LGRHS GhcRn (LocatedA (body GhcRn))] -> ExpRhoType -> TcM [LGRHS GhcTc (LocatedA (body GhcTc))]
- tcGRHSsPat :: Mult -> GRHSs GhcRn (LHsExpr GhcRn) -> ExpRhoType -> TcM (GRHSs GhcTc (LHsExpr GhcTc))
- type TcStmtChecker (body :: Type -> Type) rho_type = forall thing. HsStmtContextRn -> Stmt GhcRn (LocatedA (body GhcRn)) -> rho_type -> (rho_type -> TcM thing) -> TcM (Stmt GhcTc (LocatedA (body GhcTc)), thing)
- type TcExprStmtChecker = TcStmtChecker HsExpr ExpRhoType
- type TcCmdStmtChecker = TcStmtChecker HsCmd TcRhoType
- tcStmts :: forall (body :: Type -> Type) rho_type. AnnoBody body => HsStmtContextRn -> TcStmtChecker body rho_type -> [LStmt GhcRn (LocatedA (body GhcRn))] -> rho_type -> TcM [LStmt GhcTc (LocatedA (body GhcTc))]
- tcStmtsAndThen :: forall (body :: Type -> Type) rho_type thing. AnnoBody body => HsStmtContextRn -> TcStmtChecker body rho_type -> [LStmt GhcRn (LocatedA (body GhcRn))] -> rho_type -> (rho_type -> TcM thing) -> TcM ([LStmt GhcTc (LocatedA (body GhcTc))], thing)
- tcDoStmts :: HsDoFlavour -> LocatedL [LStmt GhcRn (LHsExpr GhcRn)] -> ExpRhoType -> TcM (HsExpr GhcTc)
- tcBody :: LHsExpr GhcRn -> ExpRhoType -> TcM (LHsExpr GhcTc)
- tcDoStmt :: TcExprStmtChecker
- tcGuardStmt :: TcExprStmtChecker
- checkArgCounts :: AnnoBody body => MatchGroup GhcRn (LocatedA (body GhcRn)) -> TcM VisArity

# Documentation

tcFunBindMatches :: UserTypeCtxt -> Name -> Mult -> MatchGroup GhcRn (LHsExpr GhcRn) -> [ExpPatType] -> ExpRhoType -> TcM (HsWrapper, MatchGroup GhcTc (LHsExpr GhcTc)) Source #

tcCaseMatches Source #

Arguments

:: (AnnoBody body, Outputable (body GhcTc)) |
=> HsMatchContextRn |
-> TcMatchAltChecker body | Typecheck the alternative RHSS
-> Scaled TcSigmaTypeFRR | Type of scrutinee
-> MatchGroup GhcRn (LocatedA (body GhcRn)) | The case alternatives
-> ExpRhoType | Type of the whole case expression
-> TcM (HsWrapper, MatchGroup GhcTc (LocatedA (body GhcTc))) |

tcLambdaMatches :: HsExpr GhcRn -> HsLamVariant -> MatchGroup GhcRn (LHsExpr GhcRn) -> [ExpPatType] -> ExpSigmaType -> TcM (HsWrapper, MatchGroup GhcTc (LHsExpr GhcTc)) Source #

tcGRHSList :: AnnoBody body => HsMatchContextRn -> TcMatchAltChecker body -> [LGRHS GhcRn (LocatedA (body GhcRn))] -> ExpRhoType -> TcM [LGRHS GhcTc (LocatedA (body GhcTc))] Source #

tcGRHSsPat :: Mult -> GRHSs GhcRn (LHsExpr GhcRn) -> ExpRhoType -> TcM (GRHSs GhcTc (LHsExpr GhcTc)) Source #

type TcStmtChecker (body :: Type -> Type) rho_type = forall thing. HsStmtContextRn -> Stmt GhcRn (LocatedA (body GhcRn)) -> rho_type -> (rho_type -> TcM thing) -> TcM (Stmt GhcTc (LocatedA (body GhcTc)), thing) Source #

type TcExprStmtChecker = TcStmtChecker HsExpr ExpRhoType Source #

type TcCmdStmtChecker = TcStmtChecker HsCmd TcRhoType Source #

tcStmts :: forall (body :: Type -> Type) rho_type. AnnoBody body => HsStmtContextRn -> TcStmtChecker body rho_type -> [LStmt GhcRn (LocatedA (body GhcRn))] -> rho_type -> TcM [LStmt GhcTc (LocatedA (body GhcTc))] Source #

tcStmtsAndThen :: forall (body :: Type -> Type) rho_type thing. AnnoBody body => HsStmtContextRn -> TcStmtChecker body rho_type -> [LStmt GhcRn (LocatedA (body GhcRn))] -> rho_type -> (rho_type -> TcM thing) -> TcM ([LStmt GhcTc (LocatedA (body GhcTc))], thing) Source #

tcDoStmts :: HsDoFlavour -> LocatedL [LStmt GhcRn (LHsExpr GhcRn)] -> ExpRhoType -> TcM (HsExpr GhcTc) Source #

tcBody :: LHsExpr GhcRn -> ExpRhoType -> TcM (LHsExpr GhcTc) Source #

tcDoStmt :: TcExprStmtChecker Source #

tcGuardStmt :: TcExprStmtChecker Source #

checkArgCounts :: AnnoBody body => MatchGroup GhcRn (LocatedA (body GhcRn)) -> TcM VisArity Source #

`checkArgCounts` takes a `[RenamedMatch]` and decides whether the same number of required args are used in each equation. Returns the arity, the number of required args E.g. f @a True y = ... f False z = ... The MatchGroup for `f` has arity 2, not 3