Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utility functions for constructing Core syntax, principally for desugaring
- data EquationInfo = EqnInfo {
- eqn_pats :: [Pat Id]
- eqn_rhs :: MatchResult
- firstPat :: EquationInfo -> Pat Id
- shiftEqns :: [EquationInfo] -> [EquationInfo]
- data MatchResult = MatchResult CanItFail (CoreExpr -> DsM CoreExpr)
- data CanItFail
- data CaseAlt a = MkCaseAlt {
- alt_pat :: a
- alt_bndrs :: [Var]
- alt_wrapper :: HsWrapper
- alt_result :: MatchResult
- cantFailMatchResult :: CoreExpr -> MatchResult
- alwaysFailMatchResult :: MatchResult
- extractMatchResult :: MatchResult -> CoreExpr -> DsM CoreExpr
- combineMatchResults :: MatchResult -> MatchResult -> MatchResult
- adjustMatchResult :: DsWrapper -> MatchResult -> MatchResult
- adjustMatchResultDs :: (CoreExpr -> DsM CoreExpr) -> MatchResult -> MatchResult
- mkCoLetMatchResult :: CoreBind -> MatchResult -> MatchResult
- mkViewMatchResult :: Id -> CoreExpr -> MatchResult -> MatchResult
- mkGuardedMatchResult :: CoreExpr -> MatchResult -> MatchResult
- matchCanFail :: MatchResult -> Bool
- mkEvalMatchResult :: Id -> Type -> MatchResult -> MatchResult
- mkCoPrimCaseMatchResult :: Id -> Type -> [(Literal, MatchResult)] -> MatchResult
- mkCoAlgCaseMatchResult :: DynFlags -> Id -> Type -> [CaseAlt DataCon] -> MatchResult
- mkCoSynCaseMatchResult :: Id -> Type -> CaseAlt PatSyn -> MatchResult
- wrapBind :: Var -> Var -> CoreExpr -> CoreExpr
- wrapBinds :: [(Var, Var)] -> CoreExpr -> CoreExpr
- mkErrorAppDs :: Id -> Type -> SDoc -> DsM CoreExpr
- mkCoreAppDs :: SDoc -> CoreExpr -> CoreExpr -> CoreExpr
- mkCoreAppsDs :: SDoc -> CoreExpr -> [CoreExpr] -> CoreExpr
- mkCastDs :: CoreExpr -> Coercion -> CoreExpr
- seqVar :: Var -> CoreExpr -> CoreExpr
- mkLHsVarPatTup :: [Id] -> LPat Id
- mkLHsPatTup :: [LPat Id] -> LPat Id
- mkVanillaTuplePat :: [OutPat Id] -> Boxity -> Pat Id
- mkBigLHsVarTupId :: [Id] -> LHsExpr Id
- mkBigLHsTupId :: [LHsExpr Id] -> LHsExpr Id
- mkBigLHsVarPatTupId :: [Id] -> LPat Id
- mkBigLHsPatTupId :: [LPat Id] -> LPat Id
- mkSelectorBinds :: [[Tickish Id]] -> LPat Id -> CoreExpr -> DsM (Id, [(Id, CoreExpr)])
- selectSimpleMatchVarL :: LPat Id -> DsM Id
- selectMatchVars :: [Pat Id] -> DsM [Id]
- selectMatchVar :: Pat Id -> DsM Id
- mkOptTickBox :: [Tickish Id] -> CoreExpr -> CoreExpr
- mkBinaryTickBox :: Int -> Int -> CoreExpr -> DsM CoreExpr
- decideBangHood :: DynFlags -> LPat id -> LPat id
Documentation
data EquationInfo Source #
shiftEqns :: [EquationInfo] -> [EquationInfo] Source #
data MatchResult Source #
MkCaseAlt | |
|
extractMatchResult :: MatchResult -> CoreExpr -> DsM CoreExpr Source #
adjustMatchResult :: DsWrapper -> MatchResult -> MatchResult Source #
adjustMatchResultDs :: (CoreExpr -> DsM CoreExpr) -> MatchResult -> MatchResult Source #
mkCoLetMatchResult :: CoreBind -> MatchResult -> MatchResult Source #
mkViewMatchResult :: Id -> CoreExpr -> MatchResult -> MatchResult Source #
matchCanFail :: MatchResult -> Bool Source #
mkEvalMatchResult :: Id -> Type -> MatchResult -> MatchResult Source #
mkCoPrimCaseMatchResult :: Id -> Type -> [(Literal, MatchResult)] -> MatchResult Source #
mkCoAlgCaseMatchResult :: DynFlags -> Id -> Type -> [CaseAlt DataCon] -> MatchResult Source #
mkCoSynCaseMatchResult :: Id -> Type -> CaseAlt PatSyn -> MatchResult Source #
Remove any bang from a pattern and say if it is a strict bind, also make irrefutable patterns ordinary patterns if -XStrict.
Examples: ~pat => False, pat -- when -XStrict -- even if pat = ~pat' ~pat => False, ~pat -- without -XStrict ~(~pat) => False, ~pat -- when -XStrict pat => True, pat -- when -XStrict !pat => True, pat -- always