GHC.HsToCore.Utils
Utility functions for constructing Core syntax, principally for desugaring
Documentation
data EquationInfo Source #
Constructors
EqnInfo | |
Fields
|
Instances
Outputable EquationInfo Source # | |
Defined in GHC.HsToCore.Monad Methods ppr :: EquationInfo -> SDoc Source # |
shiftEqns :: Functor f => f EquationInfo -> f EquationInfo Source #
data MatchResult a Source #
This is a value of type a with potentially a CoreExpr-shaped hole in it. This is used to deal with cases where we are potentially handling pattern match failure, and want to later specify how failure is handled.
Constructors
MR_Infallible (DsM a) | We represent the case where there is no hole without a function from
|
MR_Fallible (CoreExpr -> DsM a) |
Instances
Applicative MatchResult Source # | Product is an "or" on falliblity---the combined match result is infallible only if the left and right argument match results both were. This is useful for combining a bunch of alternatives together and then
getting the overall falliblity of the entire group. See |
Defined in GHC.HsToCore.Monad Methods pure :: a -> MatchResult a Source # (<*>) :: MatchResult (a -> b) -> MatchResult a -> MatchResult b Source # liftA2 :: (a -> b -> c) -> MatchResult a -> MatchResult b -> MatchResult c Source # (*>) :: MatchResult a -> MatchResult b -> MatchResult b Source # (<*) :: MatchResult a -> MatchResult b -> MatchResult a Source # | |
Functor MatchResult Source # | |
Defined in GHC.HsToCore.Monad Methods fmap :: (a -> b) -> MatchResult a -> MatchResult b Source # (<$) :: a -> MatchResult b -> MatchResult a Source # |
Constructors
MkCaseAlt | |
Fields
|
extractMatchResult :: MatchResult CoreExpr -> CoreExpr -> DsM CoreExpr Source #
combineMatchResults :: MatchResult CoreExpr -> MatchResult CoreExpr -> MatchResult CoreExpr Source #
adjustMatchResultDs :: (a -> DsM b) -> MatchResult a -> MatchResult b Source #
dsHandleMonadicFailure :: HsDoFlavour -> LPat GhcTc -> MatchResult CoreExpr -> FailOperator GhcTc -> DsM CoreExpr Source #
mkViewMatchResult :: Id -> CoreExpr -> MatchResult CoreExpr -> MatchResult CoreExpr Source #
matchCanFail :: MatchResult a -> Bool Source #
mkEvalMatchResult :: Id -> Type -> MatchResult CoreExpr -> MatchResult CoreExpr Source #
mkCoPrimCaseMatchResult :: Id -> Type -> [(Literal, MatchResult CoreExpr)] -> MatchResult CoreExpr Source #
mkCoSynCaseMatchResult :: Id -> Type -> CaseAlt PatSyn -> MatchResult CoreExpr Source #
mkFailExpr :: HsMatchContext GhcRn -> Type -> DsM CoreExpr Source #
Arguments
:: [[CoreTickish]] | ticks to add, possibly |
-> LPat GhcTc | The pattern |
-> CoreExpr | Expression to which the pattern is bound |
-> DsM (Id, [(Id, CoreExpr)]) | Id the rhs is bound to, for desugaring strict binds (see Note [Desugar Strict binds] in GHC.HsToCore.Binds) and all the desugared binds |
mkOptTickBox :: [CoreTickish] -> CoreExpr -> CoreExpr Source #
Use -XStrict to add a ! or remove a ~ See Note [decideBangHood]