Safe Haskell | None |
---|---|
Language | GHC2021 |
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)) => 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 #
:: (AnnoBody body, Outputable (body GhcTc)) | |
=> 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 #
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 #
checkArgCounts :: AnnoBody body => MatchGroup GhcRn (LocatedA (body GhcRn)) -> TcM VisArity Source #
checkArgCounts
takes a [RenamedMatch]
and decides whether the same
number of required (aka visible) 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