ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.HsToCore.Match

Synopsis

- match :: [MatchId] -> Type -> [EquationInfo] -> DsM (MatchResult CoreExpr)
- matchEquations :: HsMatchContext GhcRn -> [MatchId] -> [EquationInfo] -> Type -> DsM CoreExpr
- matchWrapper :: HsMatchContext GhcRn -> Maybe [LHsExpr GhcTc] -> MatchGroup GhcTc (LHsExpr GhcTc) -> DsM ([Id], CoreExpr)
- matchSimply :: CoreExpr -> HsMatchContext GhcRn -> LPat GhcTc -> CoreExpr -> CoreExpr -> DsM CoreExpr
- matchSinglePat :: CoreExpr -> HsMatchContext GhcRn -> LPat GhcTc -> Type -> MatchResult CoreExpr -> DsM (MatchResult CoreExpr)
- matchSinglePatVar :: Id -> Maybe CoreExpr -> HsMatchContext GhcRn -> LPat GhcTc -> Type -> MatchResult CoreExpr -> DsM (MatchResult CoreExpr)

# Documentation

match Source #

Arguments

:: [MatchId] | Variables rep'ing the exprs we're matching with ^ See Note [Match Ids] ^ Note that the Match Ids carry not only a name, but ^ also the multiplicity at which each column has been ^ type checked.
-> Type | Type of the case expression
-> [EquationInfo] | Info about patterns, etc. (type synonym below)
-> DsM (MatchResult CoreExpr) | Desugared result!

matchEquations :: HsMatchContext GhcRn -> [MatchId] -> [EquationInfo] -> Type -> DsM CoreExpr Source #

matchWrapper Source #

Arguments

:: HsMatchContext GhcRn | For shadowing warning messages
-> Maybe [LHsExpr GhcTc] | Scrutinee(s) see Note [matchWrapper scrutinees]
-> MatchGroup GhcTc (LHsExpr GhcTc) | Matches being desugared
-> DsM ([Id], CoreExpr) | Results (usually passed to `match`)

matchSimply Source #

Arguments

:: CoreExpr | Scrutinee
-> HsMatchContext GhcRn | Match kind
-> LPat GhcTc | Pattern it should match
-> CoreExpr | Return this if it matches
-> CoreExpr | Return this if it doesn't
-> DsM CoreExpr |

`matchSimply` is a wrapper for `match` which deals with the situation where we want to match a single expression against a single pattern. It returns an expression.

matchSinglePat :: CoreExpr -> HsMatchContext GhcRn -> LPat GhcTc -> Type -> MatchResult CoreExpr -> DsM (MatchResult CoreExpr) Source #

matchSinglePatVar Source #

Arguments

:: Id |
-> Maybe CoreExpr | The scrutinee the match id is bound to
-> HsMatchContext GhcRn |
-> LPat GhcTc |
-> Type |
-> MatchResult CoreExpr |
-> DsM (MatchResult CoreExpr) |