Safe Haskell | None |
---|---|
Language | Haskell98 |
HsExpr
Contents
Description
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 CmdSyntaxTable id = [(Name, SyntaxExpr id)]
- noSyntaxTable :: CmdSyntaxTable id
- data HsExpr id
- = HsVar id
- | HsIPVar HsIPName
- | HsOverLit (HsOverLit id)
- | HsLit HsLit
- | HsLam (MatchGroup id (LHsExpr id))
- | HsLamCase PostTcType (MatchGroup id (LHsExpr 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 (LHsExpr id))
- | HsIf (Maybe (SyntaxExpr id)) (LHsExpr id) (LHsExpr id) (LHsExpr id)
- | HsMultiIf PostTcType [LGRHS id (LHsExpr id)]
- | HsLet (HsLocalBinds id) (LHsExpr id)
- | HsDo (HsStmtContext Name) [ExprLStmt id] PostTcType
- | ExplicitList PostTcType (Maybe (SyntaxExpr id)) [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 (Maybe (SyntaxExpr id)) (ArithSeqInfo id)
- | PArrSeq PostTcExpr (ArithSeqInfo id)
- | HsSCC FastString (LHsExpr id)
- | HsCoreAnn FastString (LHsExpr id)
- | HsBracket (HsBracket id)
- | HsRnBracketOut (HsBracket Name) [PendingRnSplice]
- | HsTcBracketOut (HsBracket Name) [PendingTcSplice]
- | HsSpliceE Bool (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)
- | HsUnboundVar RdrName
- data HsTupArg id
- = Present (LHsExpr id)
- | Missing PostTcType
- tupArgPresent :: HsTupArg id -> Bool
- data PendingRnSplice
- type PendingTcSplice = (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
- pprDebugParendExpr :: OutputableBndr id => LHsExpr id -> SDoc
- pprParendExpr :: OutputableBndr id => LHsExpr id -> SDoc
- hsExprNeedsParens :: HsExpr id -> Bool
- isAtomicHsExpr :: HsExpr id -> Bool
- type LHsCmd id = Located (HsCmd id)
- data HsCmd id
- = HsCmdArrApp (LHsExpr id) (LHsExpr id) PostTcType HsArrAppType Bool
- | HsCmdArrForm (LHsExpr id) (Maybe Fixity) [LHsCmdTop id]
- | HsCmdApp (LHsCmd id) (LHsExpr id)
- | HsCmdLam (MatchGroup id (LHsCmd id))
- | HsCmdPar (LHsCmd id)
- | HsCmdCase (LHsExpr id) (MatchGroup id (LHsCmd id))
- | HsCmdIf (Maybe (SyntaxExpr id)) (LHsExpr id) (LHsCmd id) (LHsCmd id)
- | HsCmdLet (HsLocalBinds id) (LHsCmd id)
- | HsCmdDo [CmdLStmt id] PostTcType
- | HsCmdCast TcCoercion (HsCmd id)
- data HsArrAppType
- type LHsCmdTop id = Located (HsCmdTop id)
- data HsCmdTop id = HsCmdTop (LHsCmd id) PostTcType PostTcType (CmdSyntaxTable id)
- pprLCmd :: OutputableBndr id => LHsCmd id -> SDoc
- pprCmd :: OutputableBndr id => HsCmd id -> SDoc
- isQuietHsCmd :: HsCmd id -> Bool
- ppr_lcmd :: OutputableBndr id => LHsCmd id -> SDoc
- ppr_cmd :: forall id. OutputableBndr id => HsCmd id -> SDoc
- pprCmdArg :: OutputableBndr id => HsCmdTop id -> SDoc
- type HsRecordBinds id = HsRecFields id (LHsExpr id)
- data MatchGroup id body = MG {
- mg_alts :: [LMatch id body]
- mg_arg_tys :: [PostTcType]
- mg_res_ty :: PostTcType
- type LMatch id body = Located (Match id body)
- data Match id body = Match [LPat id] (Maybe (LHsType id)) (GRHSs id body)
- isEmptyMatchGroup :: MatchGroup id body -> Bool
- matchGroupArity :: MatchGroup id body -> Arity
- hsLMatchPats :: LMatch id body -> [LPat id]
- data GRHSs id body = GRHSs {
- grhssGRHSs :: [LGRHS id body]
- grhssLocalBinds :: HsLocalBinds id
- type LGRHS id body = Located (GRHS id body)
- data GRHS id body = GRHS [GuardLStmt id] body
- pprMatches :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => HsMatchContext idL -> MatchGroup idR body -> SDoc
- pprFunBind :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => idL -> Bool -> MatchGroup idR body -> SDoc
- pprPatBind :: forall bndr id body. (OutputableBndr bndr, OutputableBndr id, Outputable body) => LPat bndr -> GRHSs id body -> SDoc
- pprMatch :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => HsMatchContext idL -> Match idR body -> SDoc
- pprGRHSs :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => HsMatchContext idL -> GRHSs idR body -> SDoc
- pprGRHS :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => HsMatchContext idL -> GRHS idR body -> SDoc
- pp_rhs :: Outputable body => HsMatchContext idL -> body -> SDoc
- type LStmt id body = Located (StmtLR id id body)
- type LStmtLR idL idR body = Located (StmtLR idL idR body)
- type Stmt id body = StmtLR id id body
- type CmdLStmt id = LStmt id (LHsCmd id)
- type CmdStmt id = Stmt id (LHsCmd id)
- type ExprLStmt id = LStmt id (LHsExpr id)
- type ExprStmt id = Stmt id (LHsExpr id)
- type GuardLStmt id = LStmt id (LHsExpr id)
- type GuardStmt id = Stmt id (LHsExpr id)
- type GhciLStmt id = LStmt id (LHsExpr id)
- type GhciStmt id = Stmt id (LHsExpr id)
- data StmtLR idL idR body
- = LastStmt body (SyntaxExpr idR)
- | BindStmt (LPat idL) body (SyntaxExpr idR) (SyntaxExpr idR)
- | BodyStmt body (SyntaxExpr idR) (SyntaxExpr idR) PostTcType
- | LetStmt (HsLocalBindsLR idL idR)
- | ParStmt [ParStmtBlock idL idR] (SyntaxExpr idR) (SyntaxExpr idR)
- | TransStmt { }
- | RecStmt {
- recS_stmts :: [LStmtLR idL idR body]
- 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 [ExprLStmt idL] [idR] (SyntaxExpr idR)
- pprStmt :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => StmtLR idL idR body -> SDoc
- pprTransformStmt :: OutputableBndr id => [id] -> LHsExpr id -> Maybe (LHsExpr id) -> SDoc
- pprTransStmt :: Outputable body => Maybe body -> body -> TransForm -> SDoc
- pprBy :: Outputable body => Maybe body -> SDoc
- pprDo :: (OutputableBndr id, Outputable body) => HsStmtContext any -> [LStmt id body] -> SDoc
- ppr_do_stmts :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => [LStmtLR idL idR body] -> SDoc
- pprComp :: (OutputableBndr id, Outputable body) => [LStmt id body] -> SDoc
- pprQuals :: (OutputableBndr id, Outputable body) => [LStmt id body] -> SDoc
- data HsSplice id = HsSplice id (LHsExpr id)
- pprUntypedSplice :: OutputableBndr id => HsSplice id -> SDoc
- pprTypedSplice :: OutputableBndr id => HsSplice id -> SDoc
- pprSplice :: OutputableBndr id => Bool -> HsSplice id -> SDoc
- data HsBracket id
- isTypedBracket :: HsBracket id -> Bool
- pprHsBracket :: OutputableBndr id => HsBracket id -> SDoc
- thBrackets :: SDoc -> SDoc -> SDoc
- thTyBrackets :: SDoc -> SDoc
- data ArithSeqInfo id
- pp_dotdot :: SDoc
- data HsMatchContext id
- = FunRhs id Bool
- | LambdaExpr
- | CaseAlt
- | IfAlt
- | ProcExpr
- | PatBindRhs
- | RecUpd
- | StmtCtxt (HsStmtContext id)
- | ThPatSplice
- | ThPatQuote
- | PatSyn
- data HsStmtContext id
- = ListComp
- | MonadComp
- | PArrComp
- | DoExpr
- | MDoExpr
- | ArrowExpr
- | GhciStmtCtxt
- | 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, Outputable body) => HsMatchContext idL -> Match idR body -> SDoc
- pprStmtInCtxt :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => HsStmtContext idL -> StmtLR idL idR body -> 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 CmdSyntaxTable id = [(Name, SyntaxExpr id)]Source
A Haskell expression.
Constructors
Instances
Data id => Data (HsExpr id) | |
OutputableBndr id => Outputable (HsExpr id) | |
Typeable (* -> *) HsExpr |
HsTupArg is used for tuple sections (,a,) is represented by ExplicitTuple [Mising ty1, Present a, Missing ty3] Which in turn stands for (x:ty1 y:ty2. (x,a,y))
Constructors
Present (LHsExpr id) | The argument |
Missing PostTcType | The argument is missing, but this is its type |
tupArgPresent :: HsTupArg id -> BoolSource
type PendingTcSplice = (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
pprDebugParendExpr :: OutputableBndr id => LHsExpr id -> SDocSource
pprParendExpr :: OutputableBndr id => LHsExpr id -> SDocSource
hsExprNeedsParens :: HsExpr id -> BoolSource
isAtomicHsExpr :: HsExpr id -> BoolSource
Constructors
HsCmdArrApp (LHsExpr id) (LHsExpr id) PostTcType HsArrAppType Bool | |
HsCmdArrForm (LHsExpr id) (Maybe Fixity) [LHsCmdTop id] | |
HsCmdApp (LHsCmd id) (LHsExpr id) | |
HsCmdLam (MatchGroup id (LHsCmd id)) | |
HsCmdPar (LHsCmd id) | |
HsCmdCase (LHsExpr id) (MatchGroup id (LHsCmd id)) | |
HsCmdIf (Maybe (SyntaxExpr id)) (LHsExpr id) (LHsCmd id) (LHsCmd id) | |
HsCmdLet (HsLocalBinds id) (LHsCmd id) | |
HsCmdDo [CmdLStmt id] PostTcType | |
HsCmdCast TcCoercion (HsCmd id) |
Instances
Data id => Data (HsCmd id) | |
OutputableBndr id => Outputable (HsCmd id) | |
Typeable (* -> *) HsCmd |
Constructors
HsCmdTop (LHsCmd id) PostTcType PostTcType (CmdSyntaxTable id) |
Instances
Data id => Data (HsCmdTop id) | |
OutputableBndr id => Outputable (HsCmdTop id) | |
Typeable (* -> *) HsCmdTop |
pprLCmd :: OutputableBndr id => LHsCmd id -> SDocSource
pprCmd :: OutputableBndr id => HsCmd id -> SDocSource
isQuietHsCmd :: HsCmd id -> BoolSource
ppr_lcmd :: OutputableBndr id => LHsCmd id -> SDocSource
ppr_cmd :: forall id. OutputableBndr id => HsCmd id -> SDocSource
pprCmdArg :: OutputableBndr id => HsCmdTop id -> SDocSource
type HsRecordBinds id = HsRecFields id (LHsExpr id)Source
data MatchGroup id bodySource
Constructors
MG | |
Fields
|
Instances
(Data id, Data body) => Data (MatchGroup id body) | |
Typeable (* -> * -> *) MatchGroup |
isEmptyMatchGroup :: MatchGroup id body -> BoolSource
matchGroupArity :: MatchGroup id body -> AritySource
hsLMatchPats :: LMatch id body -> [LPat id]Source
GRHSs are used both for pattern bindings and for Matches
Constructors
GRHSs | |
Fields
|
Guarded Right Hand Side.
Constructors
GRHS [GuardLStmt id] body |
pprMatches :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => HsMatchContext idL -> MatchGroup idR body -> SDocSource
pprFunBind :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => idL -> Bool -> MatchGroup idR body -> SDocSource
pprPatBind :: forall bndr id body. (OutputableBndr bndr, OutputableBndr id, Outputable body) => LPat bndr -> GRHSs id body -> SDocSource
pprMatch :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => HsMatchContext idL -> Match idR body -> SDocSource
pprGRHSs :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => HsMatchContext idL -> GRHSs idR body -> SDocSource
pprGRHS :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => HsMatchContext idL -> GRHS idR body -> SDocSource
pp_rhs :: Outputable body => HsMatchContext idL -> body -> SDocSource
type GuardLStmt id = LStmt id (LHsExpr id)Source
data StmtLR idL idR bodySource
Constructors
LastStmt body (SyntaxExpr idR) | |
BindStmt (LPat idL) body (SyntaxExpr idR) (SyntaxExpr idR) | |
BodyStmt body (SyntaxExpr idR) (SyntaxExpr idR) PostTcType | |
LetStmt (HsLocalBindsLR idL idR) | |
ParStmt [ParStmtBlock idL idR] (SyntaxExpr idR) (SyntaxExpr idR) | |
TransStmt | |
RecStmt | |
Fields
|
Instances
Typeable (* -> * -> * -> *) StmtLR | |
(Data idL, Data idR, Data body) => Data (StmtLR idL idR body) | |
(OutputableBndr idL, OutputableBndr idR, Outputable body) => Outputable (StmtLR idL idR body) |
data ParStmtBlock idL idRSource
Constructors
ParStmtBlock [ExprLStmt idL] [idR] (SyntaxExpr idR) |
Instances
(Data idL, Data idR) => Data (ParStmtBlock idL idR) | |
(OutputableBndr idL, OutputableBndr idR) => Outputable (ParStmtBlock idL idR) | |
Typeable (* -> * -> *) ParStmtBlock |
pprStmt :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => StmtLR idL idR body -> SDocSource
pprTransformStmt :: OutputableBndr id => [id] -> LHsExpr id -> Maybe (LHsExpr id) -> SDocSource
pprTransStmt :: Outputable body => Maybe body -> body -> TransForm -> SDocSource
pprBy :: Outputable body => Maybe body -> SDocSource
pprDo :: (OutputableBndr id, Outputable body) => HsStmtContext any -> [LStmt id body] -> SDocSource
ppr_do_stmts :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => [LStmtLR idL idR body] -> SDocSource
pprComp :: (OutputableBndr id, Outputable body) => [LStmt id body] -> SDocSource
pprQuals :: (OutputableBndr id, Outputable body) => [LStmt id body] -> SDocSource
Instances
Data id => Data (HsSplice id) | |
OutputableBndr id => Outputable (HsSplice id) | |
Typeable (* -> *) HsSplice |
pprUntypedSplice :: OutputableBndr id => HsSplice id -> SDocSource
pprTypedSplice :: OutputableBndr id => HsSplice id -> SDocSource
Constructors
ExpBr (LHsExpr id) | |
PatBr (LPat id) | |
DecBrL [LHsDecl id] | |
DecBrG (HsGroup id) | |
TypBr (LHsType id) | |
VarBr Bool id | |
TExpBr (LHsExpr id) |
Instances
Data id => Data (HsBracket id) | |
OutputableBndr id => Outputable (HsBracket id) | |
Typeable (* -> *) HsBracket |
isTypedBracket :: HsBracket id -> BoolSource
pprHsBracket :: OutputableBndr id => HsBracket id -> SDocSource
thBrackets :: SDoc -> SDoc -> SDocSource
thTyBrackets :: SDoc -> SDocSource
data ArithSeqInfo idSource
Constructors
From (LHsExpr id) | |
FromThen (LHsExpr id) (LHsExpr id) | |
FromTo (LHsExpr id) (LHsExpr id) | |
FromThenTo (LHsExpr id) (LHsExpr id) (LHsExpr id) |
Instances
Data id => Data (ArithSeqInfo id) | |
OutputableBndr id => Outputable (ArithSeqInfo id) | |
Typeable (* -> *) ArithSeqInfo |
data HsMatchContext idSource
Constructors
FunRhs id Bool | |
LambdaExpr | |
CaseAlt | |
IfAlt | |
ProcExpr | |
PatBindRhs | |
RecUpd | |
StmtCtxt (HsStmtContext id) | |
ThPatSplice | |
ThPatQuote | |
PatSyn |
Instances
Data id => Data (HsMatchContext id) | |
Typeable (* -> *) HsMatchContext |
data HsStmtContext idSource
Constructors
ListComp | |
MonadComp | |
PArrComp | |
DoExpr | |
MDoExpr | |
ArrowExpr | |
GhciStmtCtxt | |
PatGuard (HsMatchContext id) | |
ParStmtCtxt (HsStmtContext id) | |
TransStmtCtxt (HsStmtContext id) |
Instances
Data id => Data (HsStmtContext id) | |
Typeable (* -> *) HsStmtContext |
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, Outputable body) => HsMatchContext idL -> Match idR body -> SDocSource
pprStmtInCtxt :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => HsStmtContext idL -> StmtLR idL idR body -> SDocSource