Safe Haskell | None |
---|
Abstract Haskell syntax for expressions.
- type LHsExpr id = Located (HsExpr id)
- type PostTcExpr = HsExpr Id
- type PostTcTable = [(Name, PostTcExpr)]
- noPostTcExpr :: PostTcExpr
- noPostTcTable :: PostTcTable
- type SyntaxExpr id = HsExpr id
- noSyntaxExpr :: SyntaxExpr id
- type SyntaxTable id = [(Name, SyntaxExpr id)]
- noSyntaxTable :: SyntaxTable id
- data HsExpr id
- = HsVar id
- | HsIPVar HsIPName
- | HsOverLit (HsOverLit id)
- | HsLit HsLit
- | HsLam (MatchGroup id)
- | HsLamCase PostTcType (MatchGroup id)
- | HsApp (LHsExpr id) (LHsExpr id)
- | OpApp (LHsExpr id) (LHsExpr id) Fixity (LHsExpr id)
- | NegApp (LHsExpr id) (SyntaxExpr id)
- | HsPar (LHsExpr id)
- | SectionL (LHsExpr id) (LHsExpr id)
- | SectionR (LHsExpr id) (LHsExpr id)
- | ExplicitTuple [HsTupArg id] Boxity
- | HsCase (LHsExpr id) (MatchGroup id)
- | HsIf (Maybe (SyntaxExpr id)) (LHsExpr id) (LHsExpr id) (LHsExpr id)
- | HsMultiIf PostTcType [LGRHS id]
- | HsLet (HsLocalBinds id) (LHsExpr id)
- | HsDo (HsStmtContext Name) [LStmt id] PostTcType
- | ExplicitList PostTcType [LHsExpr id]
- | ExplicitPArr PostTcType [LHsExpr id]
- | RecordCon (Located id) PostTcExpr (HsRecordBinds id)
- | RecordUpd (LHsExpr id) (HsRecordBinds id) [DataCon] [PostTcType] [PostTcType]
- | ExprWithTySig (LHsExpr id) (LHsType id)
- | ExprWithTySigOut (LHsExpr id) (LHsType Name)
- | ArithSeq PostTcExpr (ArithSeqInfo id)
- | PArrSeq PostTcExpr (ArithSeqInfo id)
- | HsSCC FastString (LHsExpr id)
- | HsCoreAnn FastString (LHsExpr id)
- | HsBracket (HsBracket id)
- | HsBracketOut (HsBracket Name) [PendingSplice]
- | HsSpliceE (HsSplice id)
- | HsQuasiQuoteE (HsQuasiQuote id)
- | HsProc (LPat id) (LHsCmdTop id)
- | HsArrApp (LHsExpr id) (LHsExpr id) PostTcType HsArrAppType Bool
- | HsArrForm (LHsExpr id) (Maybe Fixity) [LHsCmdTop id]
- | HsTick (Tickish id) (LHsExpr id)
- | HsBinTick Int Int (LHsExpr id)
- | HsTickPragma (FastString, (Int, Int), (Int, Int)) (LHsExpr id)
- | EWildPat
- | EAsPat (Located id) (LHsExpr id)
- | EViewPat (LHsExpr id) (LHsExpr id)
- | ELazyPat (LHsExpr id)
- | HsType (LHsType id)
- | HsWrap HsWrapper (HsExpr id)
- data HsTupArg id
- = Present (LHsExpr id)
- | Missing PostTcType
- tupArgPresent :: HsTupArg id -> Bool
- type PendingSplice = (Name, LHsExpr Id)
- pprLExpr :: OutputableBndr id => LHsExpr id -> SDoc
- pprExpr :: OutputableBndr id => HsExpr id -> SDoc
- isQuietHsExpr :: HsExpr id -> Bool
- pprBinds :: (OutputableBndr idL, OutputableBndr idR) => HsLocalBindsLR idL idR -> SDoc
- ppr_lexpr :: OutputableBndr id => LHsExpr id -> SDoc
- ppr_expr :: forall id. OutputableBndr id => HsExpr id -> SDoc
- pprCmdArg :: OutputableBndr id => HsCmdTop id -> SDoc
- pprDebugParendExpr :: OutputableBndr id => LHsExpr id -> SDoc
- pprParendExpr :: OutputableBndr id => LHsExpr id -> SDoc
- hsExprNeedsParens :: HsExpr id -> Bool
- isAtomicHsExpr :: HsExpr id -> Bool
- type HsCmd id = HsExpr id
- type LHsCmd id = LHsExpr id
- data HsArrAppType
- type LHsCmdTop id = Located (HsCmdTop id)
- data HsCmdTop id = HsCmdTop (LHsCmd id) [PostTcType] PostTcType (SyntaxTable id)
- type HsRecordBinds id = HsRecFields id (LHsExpr id)
- data MatchGroup id = MatchGroup [LMatch id] PostTcType
- type LMatch id = Located (Match id)
- data Match id = Match [LPat id] (Maybe (LHsType id)) (GRHSs id)
- isEmptyMatchGroup :: MatchGroup id -> Bool
- matchGroupArity :: MatchGroup id -> Arity
- hsLMatchPats :: LMatch id -> [LPat id]
- data GRHSs id = GRHSs {
- grhssGRHSs :: [LGRHS id]
- grhssLocalBinds :: HsLocalBinds id
- type LGRHS id = Located (GRHS id)
- data GRHS id = GRHS [LStmt id] (LHsExpr id)
- pprMatches :: (OutputableBndr idL, OutputableBndr idR) => HsMatchContext idL -> MatchGroup idR -> SDoc
- pprFunBind :: (OutputableBndr idL, OutputableBndr idR) => idL -> Bool -> MatchGroup idR -> SDoc
- pprPatBind :: forall bndr id. (OutputableBndr bndr, OutputableBndr id) => LPat bndr -> GRHSs id -> SDoc
- pprMatch :: (OutputableBndr idL, OutputableBndr idR) => HsMatchContext idL -> Match idR -> SDoc
- pprGRHSs :: (OutputableBndr idL, OutputableBndr idR) => HsMatchContext idL -> GRHSs idR -> SDoc
- pprGRHS :: (OutputableBndr idL, OutputableBndr idR) => HsMatchContext idL -> GRHS idR -> SDoc
- pp_rhs :: OutputableBndr idR => HsMatchContext idL -> LHsExpr idR -> SDoc
- type LStmt id = Located (StmtLR id id)
- type LStmtLR idL idR = Located (StmtLR idL idR)
- type Stmt id = StmtLR id id
- data StmtLR idL idR
- = LastStmt (LHsExpr idR) (SyntaxExpr idR)
- | BindStmt (LPat idL) (LHsExpr idR) (SyntaxExpr idR) (SyntaxExpr idR)
- | ExprStmt (LHsExpr idR) (SyntaxExpr idR) (SyntaxExpr idR) PostTcType
- | LetStmt (HsLocalBindsLR idL idR)
- | ParStmt [ParStmtBlock idL idR] (SyntaxExpr idR) (SyntaxExpr idR)
- | TransStmt { }
- | RecStmt {
- recS_stmts :: [LStmtLR idL idR]
- recS_later_ids :: [idR]
- recS_rec_ids :: [idR]
- recS_bind_fn :: SyntaxExpr idR
- recS_ret_fn :: SyntaxExpr idR
- recS_mfix_fn :: SyntaxExpr idR
- recS_later_rets :: [PostTcExpr]
- recS_rec_rets :: [PostTcExpr]
- recS_ret_ty :: PostTcType
- data TransForm
- data ParStmtBlock idL idR = ParStmtBlock [LStmt idL] [idR] (SyntaxExpr idR)
- pprStmt :: (OutputableBndr idL, OutputableBndr idR) => StmtLR idL idR -> SDoc
- pprTransformStmt :: OutputableBndr id => [id] -> LHsExpr id -> Maybe (LHsExpr id) -> SDoc
- pprTransStmt :: OutputableBndr id => Maybe (LHsExpr id) -> LHsExpr id -> TransForm -> SDoc
- pprBy :: OutputableBndr id => Maybe (LHsExpr id) -> SDoc
- pprDo :: OutputableBndr id => HsStmtContext any -> [LStmt id] -> SDoc
- ppr_do_stmts :: (OutputableBndr idL, OutputableBndr idR) => [LStmtLR idL idR] -> SDoc
- pprComp :: OutputableBndr id => [LStmt id] -> SDoc
- pprQuals :: OutputableBndr id => [LStmt id] -> SDoc
- data HsSplice id = HsSplice id (LHsExpr id)
- pprSplice :: OutputableBndr id => HsSplice id -> SDoc
- data HsBracket id
- pprHsBracket :: OutputableBndr id => HsBracket id -> SDoc
- thBrackets :: SDoc -> SDoc -> SDoc
- data ArithSeqInfo id
- pp_dotdot :: SDoc
- data HsMatchContext id
- = FunRhs id Bool
- | LambdaExpr
- | CaseAlt
- | IfAlt
- | ProcExpr
- | PatBindRhs
- | RecUpd
- | StmtCtxt (HsStmtContext id)
- | ThPatQuote
- data HsStmtContext id
- = ListComp
- | MonadComp
- | PArrComp
- | DoExpr
- | MDoExpr
- | ArrowExpr
- | GhciStmt
- | PatGuard (HsMatchContext id)
- | ParStmtCtxt (HsStmtContext id)
- | TransStmtCtxt (HsStmtContext id)
- isListCompExpr :: HsStmtContext id -> Bool
- isMonadCompExpr :: HsStmtContext id -> Bool
- matchSeparator :: HsMatchContext id -> SDoc
- pprMatchContext :: Outputable id => HsMatchContext id -> SDoc
- pprMatchContextNoun :: Outputable id => HsMatchContext id -> SDoc
- pprAStmtContext :: Outputable id => HsStmtContext id -> SDoc
- pprStmtContext :: Outputable id => HsStmtContext id -> SDoc
- matchContextErrString :: Outputable id => HsMatchContext id -> SDoc
- pprMatchInCtxt :: (OutputableBndr idL, OutputableBndr idR) => HsMatchContext idL -> Match idR -> SDoc
- pprStmtInCtxt :: (OutputableBndr idL, OutputableBndr idR) => HsStmtContext idL -> StmtLR idL idR -> SDoc
Expressions proper
type PostTcExpr = HsExpr IdSource
PostTcExpr is an evidence expression attached to the syntax tree by the type checker (c.f. postTcType).
type PostTcTable = [(Name, PostTcExpr)]Source
We use a PostTcTable where there are a bunch of pieces of evidence, more than is convenient to keep individually.
type SyntaxExpr id = HsExpr idSource
SyntaxExpr is like PostTcExpr
, but it's filled in a little earlier,
by the renamer. It's used for rebindable syntax.
E.g. (>>=)
is filled in before the renamer by the appropriate Name
for
(>>=)
, and then instantiated by the type checker with its type args
etc
noSyntaxExpr :: SyntaxExpr idSource
type SyntaxTable id = [(Name, SyntaxExpr id)]Source
Currently used only for CmdTop
(sigh)
- Before the renamer, this list is
noSyntaxTable
- After the renamer, it takes the form
[(std_name, HsVar actual_name)]
For example, for thereturn
op of a monad - normal case:
(GHC.Base.return, HsVar GHC.Base.return)
- with rebindable syntax:
(GHC.Base.return, return_22)
wherereturn_22
is whateverreturn
is in scope - After the type checker, it takes the form
[(std_name, expression)]
whereexpression
is the evidence for the method
A Haskell expression.
Typeable1 HsExpr | |
(Typeable (HsExpr id), Data id) => Data (HsExpr id) | |
OutputableBndr id => Outputable (HsExpr id) |
Present (LHsExpr id) | |
Missing PostTcType |
tupArgPresent :: HsTupArg id -> BoolSource
type PendingSplice = (Name, LHsExpr Id)Source
pprLExpr :: OutputableBndr id => LHsExpr id -> SDocSource
pprExpr :: OutputableBndr id => HsExpr id -> SDocSource
isQuietHsExpr :: HsExpr id -> BoolSource
pprBinds :: (OutputableBndr idL, OutputableBndr idR) => HsLocalBindsLR idL idR -> SDocSource
ppr_lexpr :: OutputableBndr id => LHsExpr id -> SDocSource
ppr_expr :: forall id. OutputableBndr id => HsExpr id -> SDocSource
pprCmdArg :: OutputableBndr id => HsCmdTop id -> SDocSource
pprDebugParendExpr :: OutputableBndr id => LHsExpr id -> SDocSource
pprParendExpr :: OutputableBndr id => LHsExpr id -> SDocSource
hsExprNeedsParens :: HsExpr id -> BoolSource
isAtomicHsExpr :: HsExpr id -> BoolSource
HsCmdTop (LHsCmd id) [PostTcType] PostTcType (SyntaxTable id) |
Typeable1 HsCmdTop | |
(Typeable (HsCmdTop id), Data id) => Data (HsCmdTop id) | |
OutputableBndr id => Outputable (HsCmdTop id) |
type HsRecordBinds id = HsRecFields id (LHsExpr id)Source
data MatchGroup id Source
MatchGroup [LMatch id] PostTcType |
Typeable1 MatchGroup | |
(Typeable (MatchGroup id), Data id) => Data (MatchGroup id) |
isEmptyMatchGroup :: MatchGroup id -> BoolSource
matchGroupArity :: MatchGroup id -> AritySource
hsLMatchPats :: LMatch id -> [LPat id]Source
GRHSs are used both for pattern bindings and for Matches
GRHSs | |
|
Guarded Right Hand Side.
pprMatches :: (OutputableBndr idL, OutputableBndr idR) => HsMatchContext idL -> MatchGroup idR -> SDocSource
pprFunBind :: (OutputableBndr idL, OutputableBndr idR) => idL -> Bool -> MatchGroup idR -> SDocSource
pprPatBind :: forall bndr id. (OutputableBndr bndr, OutputableBndr id) => LPat bndr -> GRHSs id -> SDocSource
pprMatch :: (OutputableBndr idL, OutputableBndr idR) => HsMatchContext idL -> Match idR -> SDocSource
pprGRHSs :: (OutputableBndr idL, OutputableBndr idR) => HsMatchContext idL -> GRHSs idR -> SDocSource
pprGRHS :: (OutputableBndr idL, OutputableBndr idR) => HsMatchContext idL -> GRHS idR -> SDocSource
pp_rhs :: OutputableBndr idR => HsMatchContext idL -> LHsExpr idR -> SDocSource
LastStmt (LHsExpr idR) (SyntaxExpr idR) | |
BindStmt (LPat idL) (LHsExpr idR) (SyntaxExpr idR) (SyntaxExpr idR) | |
ExprStmt (LHsExpr idR) (SyntaxExpr idR) (SyntaxExpr idR) PostTcType | |
LetStmt (HsLocalBindsLR idL idR) | |
ParStmt [ParStmtBlock idL idR] (SyntaxExpr idR) (SyntaxExpr idR) | |
TransStmt | |
RecStmt | |
|
Typeable2 StmtLR | |
(Typeable (StmtLR idL idR), Data idL, Data idR) => Data (StmtLR idL idR) | |
(OutputableBndr idL, OutputableBndr idR) => Outputable (StmtLR idL idR) |
data ParStmtBlock idL idR Source
ParStmtBlock [LStmt idL] [idR] (SyntaxExpr idR) |
Typeable2 ParStmtBlock | |
(Typeable (ParStmtBlock idL idR), Data idL, Data idR) => Data (ParStmtBlock idL idR) | |
(OutputableBndr idL, OutputableBndr idR) => Outputable (ParStmtBlock idL idR) |
pprStmt :: (OutputableBndr idL, OutputableBndr idR) => StmtLR idL idR -> SDocSource
pprTransformStmt :: OutputableBndr id => [id] -> LHsExpr id -> Maybe (LHsExpr id) -> SDocSource
pprTransStmt :: OutputableBndr id => Maybe (LHsExpr id) -> LHsExpr id -> TransForm -> SDocSource
pprDo :: OutputableBndr id => HsStmtContext any -> [LStmt id] -> SDocSource
ppr_do_stmts :: (OutputableBndr idL, OutputableBndr idR) => [LStmtLR idL idR] -> SDocSource
pprComp :: OutputableBndr id => [LStmt id] -> SDocSource
pprQuals :: OutputableBndr id => [LStmt id] -> SDocSource
Typeable1 HsSplice | |
(Typeable (HsSplice id), Data id) => Data (HsSplice id) | |
OutputableBndr id => Outputable (HsSplice id) |
pprSplice :: OutputableBndr id => HsSplice id -> SDocSource
ExpBr (LHsExpr id) | |
PatBr (LPat id) | |
DecBrL [LHsDecl id] | |
DecBrG (HsGroup id) | |
TypBr (LHsType id) | |
VarBr Bool id |
Typeable1 HsBracket | |
(Typeable (HsBracket id), Data id) => Data (HsBracket id) | |
OutputableBndr id => Outputable (HsBracket id) |
pprHsBracket :: OutputableBndr id => HsBracket id -> SDocSource
thBrackets :: SDoc -> SDoc -> SDocSource
data ArithSeqInfo id Source
From (LHsExpr id) | |
FromThen (LHsExpr id) (LHsExpr id) | |
FromTo (LHsExpr id) (LHsExpr id) | |
FromThenTo (LHsExpr id) (LHsExpr id) (LHsExpr id) |
Typeable1 ArithSeqInfo | |
(Typeable (ArithSeqInfo id), Data id) => Data (ArithSeqInfo id) | |
OutputableBndr id => Outputable (ArithSeqInfo id) |
data HsMatchContext id Source
FunRhs id Bool | |
LambdaExpr | |
CaseAlt | |
IfAlt | |
ProcExpr | |
PatBindRhs | |
RecUpd | |
StmtCtxt (HsStmtContext id) | |
ThPatQuote |
Typeable1 HsMatchContext | |
(Typeable (HsMatchContext id), Data id) => Data (HsMatchContext id) |
data HsStmtContext id Source
ListComp | |
MonadComp | |
PArrComp | |
DoExpr | |
MDoExpr | |
ArrowExpr | |
GhciStmt | |
PatGuard (HsMatchContext id) | |
ParStmtCtxt (HsStmtContext id) | |
TransStmtCtxt (HsStmtContext id) |
Typeable1 HsStmtContext | |
(Typeable (HsStmtContext id), Data id) => Data (HsStmtContext id) |
isListCompExpr :: HsStmtContext id -> BoolSource
isMonadCompExpr :: HsStmtContext id -> BoolSource
matchSeparator :: HsMatchContext id -> SDocSource
pprMatchContext :: Outputable id => HsMatchContext id -> SDocSource
pprMatchContextNoun :: Outputable id => HsMatchContext id -> SDocSource
pprAStmtContext :: Outputable id => HsStmtContext id -> SDocSource
pprStmtContext :: Outputable id => HsStmtContext id -> SDocSource
matchContextErrString :: Outputable id => HsMatchContext id -> SDocSource
pprMatchInCtxt :: (OutputableBndr idL, OutputableBndr idR) => HsMatchContext idL -> Match idR -> SDocSource
pprStmtInCtxt :: (OutputableBndr idL, OutputableBndr idR) => HsStmtContext idL -> StmtLR idL idR -> SDocSource