Safe Haskell | None |
---|---|
Language | Haskell98 |
The abstract syntax. This is what you get after desugaring and scope analysis of the concrete syntax. The type checker works on abstract syntax, producing internal syntax (Agda.Syntax.Internal).
- type Args = [NamedArg Expr]
- data Expr
- = Var Name
- | Def QName
- | Proj QName
- | Con AmbiguousQName
- | PatternSyn QName
- | Macro QName
- | Lit Literal
- | QuestionMark MetaInfo InteractionId
- | Underscore MetaInfo
- | App ExprInfo Expr (NamedArg Expr)
- | WithApp ExprInfo Expr [Expr]
- | Lam ExprInfo LamBinding Expr
- | AbsurdLam ExprInfo Hiding
- | ExtendedLam ExprInfo DefInfo QName [Clause]
- | Pi ExprInfo Telescope Expr
- | Fun ExprInfo (Arg Expr) Expr
- | Set ExprInfo Integer
- | Prop ExprInfo
- | Let ExprInfo [LetBinding] Expr
- | ETel Telescope
- | Rec ExprInfo RecordAssigns
- | RecUpdate ExprInfo Expr Assigns
- | ScopedExpr ScopeInfo Expr
- | QuoteGoal ExprInfo Name Expr
- | QuoteContext ExprInfo
- | Quote ExprInfo
- | QuoteTerm ExprInfo
- | Unquote ExprInfo
- | Tactic ExprInfo Expr [NamedArg Expr] [NamedArg Expr]
- | DontCare Expr
- type Assign = FieldAssignment' Expr
- type Assigns = [Assign]
- type RecordAssign = Either Assign ModuleName
- type RecordAssigns = [RecordAssign]
- data Axiom
- type Ren a = [(a, a)]
- data Declaration
- = Axiom Axiom DefInfo ArgInfo QName Expr
- | Field DefInfo QName (Arg Expr)
- | Primitive DefInfo QName Expr
- | Mutual MutualInfo [Declaration]
- | Section ModuleInfo ModuleName [TypedBindings] [Declaration]
- | Apply ModuleInfo ModuleName ModuleApplication (Ren QName) (Ren ModuleName) ImportDirective
- | Import ModuleInfo ModuleName ImportDirective
- | Pragma Range Pragma
- | Open ModuleInfo ModuleName ImportDirective
- | FunDef DefInfo QName Delayed [Clause]
- | DataSig DefInfo QName Telescope Expr
- | DataDef DefInfo QName [LamBinding] [Constructor]
- | RecSig DefInfo QName Telescope Expr
- | RecDef DefInfo QName (Maybe (Ranged Induction)) (Maybe Bool) (Maybe QName) [LamBinding] Expr [Declaration]
- | PatternSynDef QName [Arg Name] (Pattern' Void)
- | UnquoteDecl MutualInfo [DefInfo] [QName] Expr
- | UnquoteDef [DefInfo] [QName] Expr
- | ScopedDecl ScopeInfo [Declaration]
- class GetDefInfo a where
- getDefInfo :: a -> Maybe DefInfo
- type ImportDirective = ImportDirective' QName ModuleName
- type Renaming = Renaming' QName ModuleName
- type ImportedName = ImportedName' QName ModuleName
- data ModuleApplication
- data Pragma
- = OptionsPragma [String]
- | BuiltinPragma String Expr
- | BuiltinNoDefPragma String QName
- | RewritePragma QName
- | CompiledPragma QName String
- | CompiledExportPragma QName String
- | CompiledDeclareDataPragma QName String
- | CompiledTypePragma QName String
- | CompiledDataPragma QName String [String]
- | CompiledEpicPragma QName String
- | CompiledJSPragma QName String
- | CompiledUHCPragma QName String
- | CompiledDataUHCPragma QName String [String]
- | NoSmashingPragma QName
- | StaticPragma QName
- | InlinePragma QName
- | DisplayPragma QName [NamedArg Pattern] Expr
- data LetBinding
- type TypeSignature = Declaration
- type Constructor = TypeSignature
- type Field = TypeSignature
- data LamBinding
- data TypedBindings = TypedBindings Range (Arg TypedBinding)
- data TypedBinding
- = TBind Range [WithHiding Name] Expr
- | TLet Range [LetBinding]
- type Telescope = [TypedBindings]
- data Clause' lhs = Clause {
- clauseLHS :: lhs
- clauseRHS :: RHS
- clauseWhereDecls :: [Declaration]
- clauseCatchall :: Bool
- type Clause = Clause' LHS
- type SpineClause = Clause' SpineLHS
- data RHS
- data SpineLHS = SpineLHS {
- spLhsInfo :: LHSInfo
- spLhsDefName :: QName
- spLhsPats :: [NamedArg Pattern]
- spLhsWithPats :: [Pattern]
- data LHS = LHS {}
- data LHSCore' e
- = LHSHead {
- lhsDefName :: QName
- lhsPats :: [NamedArg (Pattern' e)]
- | LHSProj {
- lhsDestructor :: QName
- lhsPatsLeft :: [NamedArg (Pattern' e)]
- lhsFocus :: NamedArg (LHSCore' e)
- lhsPatsRight :: [NamedArg (Pattern' e)]
- = LHSHead {
- type LHSCore = LHSCore' Expr
- class LHSToSpine a b where
- lhsToSpine :: a -> b
- spineToLhs :: b -> a
- lhsCoreToSpine :: LHSCore' e -> QNamed [NamedArg (Pattern' e)]
- spineToLhsCore :: QNamed [NamedArg (Pattern' e)] -> LHSCore' e
- lhsCoreApp :: LHSCore' e -> [NamedArg (Pattern' e)] -> LHSCore' e
- lhsCoreAddSpine :: LHSCore' e -> [NamedArg (Pattern' e)] -> LHSCore' e
- lhsCoreAllPatterns :: LHSCore' e -> [Pattern' e]
- lhsCoreToPattern :: LHSCore -> Pattern
- mapLHSHead :: (QName -> [NamedArg Pattern] -> LHSCore) -> LHSCore -> LHSCore
- data Pattern' e
- = VarP Name
- | ConP ConPatInfo AmbiguousQName [NamedArg (Pattern' e)]
- | DefP PatInfo QName [NamedArg (Pattern' e)]
- | WildP PatInfo
- | AsP PatInfo Name (Pattern' e)
- | DotP PatInfo e
- | AbsurdP PatInfo
- | LitP Literal
- | PatternSynP PatInfo QName [NamedArg (Pattern' e)]
- | RecP PatInfo [FieldAssignment' (Pattern' e)]
- type Pattern = Pattern' Expr
- type Patterns = [NamedArg Pattern]
- class IsProjP a where
- class AllNames a where
- axiomName :: Declaration -> QName
- class AnyAbstract a where
- anyAbstract :: a -> Bool
- nameExpr :: AbstractName -> Expr
- app :: Expr -> [NamedArg Expr] -> Expr
- mkLet :: ExprInfo -> [LetBinding] -> Expr -> Expr
- patternToExpr :: Pattern -> Expr
- type PatternSynDefn = ([Arg Name], Pattern' Void)
- type PatternSynDefns = Map QName PatternSynDefn
- lambdaLiftExpr :: [Name] -> Expr -> Expr
- substPattern :: [(Name, Pattern)] -> Pattern -> Pattern
- class SubstExpr a where
- insertImplicitPatSynArgs :: HasRange a => (Range -> a) -> Range -> [Arg Name] -> [NamedArg a] -> Maybe ([(Name, a)], [Arg Name])
- module Agda.Syntax.Abstract.Name
Documentation
Expressions after scope checking (operators parsed, names resolved).
Var Name | Bound variable. |
Def QName | Constant: axiom, function, data or record type. |
Proj QName | Projection. |
Con AmbiguousQName | Constructor. |
PatternSyn QName | Pattern synonym. |
Macro QName | Macro. |
Lit Literal | Literal. |
QuestionMark MetaInfo InteractionId | Meta variable for interaction.
The |
Underscore MetaInfo | Meta variable for hidden argument (must be inferred locally). |
App ExprInfo Expr (NamedArg Expr) | Ordinary (binary) application. |
WithApp ExprInfo Expr [Expr] | With application. |
Lam ExprInfo LamBinding Expr |
|
AbsurdLam ExprInfo Hiding |
|
ExtendedLam ExprInfo DefInfo QName [Clause] | |
Pi ExprInfo Telescope Expr | Dependent function space |
Fun ExprInfo (Arg Expr) Expr | Non-dependent function space. |
Set ExprInfo Integer |
|
Prop ExprInfo |
|
Let ExprInfo [LetBinding] Expr |
|
ETel Telescope | Only used when printing telescopes. |
Rec ExprInfo RecordAssigns | Record construction. |
RecUpdate ExprInfo Expr Assigns | Record update. |
ScopedExpr ScopeInfo Expr | Scope annotation. |
QuoteGoal ExprInfo Name Expr | Binds |
QuoteContext ExprInfo | Returns the current context. |
Quote ExprInfo | Quote an identifier |
QuoteTerm ExprInfo | Quote a term. |
Unquote ExprInfo | The splicing construct: unquote ... |
Tactic ExprInfo Expr [NamedArg Expr] [NamedArg Expr] | tactic e x1 .. xn | y1 | .. | yn |
DontCare Expr | For printing |
type Assign = FieldAssignment' Expr Source
Record field assignment f = e
.
type RecordAssign = Either Assign ModuleName Source
type RecordAssigns = [RecordAssign] Source
Is a type signature a postulate
or a function signature?
data Declaration Source
Axiom Axiom DefInfo ArgInfo QName Expr | type signature (can be irrelevant and colored, but not hidden) |
Field DefInfo QName (Arg Expr) | record field |
Primitive DefInfo QName Expr | primitive function |
Mutual MutualInfo [Declaration] | a bunch of mutually recursive definitions |
Section ModuleInfo ModuleName [TypedBindings] [Declaration] | |
Apply ModuleInfo ModuleName ModuleApplication (Ren QName) (Ren ModuleName) ImportDirective | The |
Import ModuleInfo ModuleName ImportDirective | The |
Pragma Range Pragma | |
Open ModuleInfo ModuleName ImportDirective | only retained for highlighting purposes |
FunDef DefInfo QName Delayed [Clause] | sequence of function clauses |
DataSig DefInfo QName Telescope Expr | lone data signature
^ the |
DataDef DefInfo QName [LamBinding] [Constructor] | the |
RecSig DefInfo QName Telescope Expr | lone record signature |
RecDef DefInfo QName (Maybe (Ranged Induction)) (Maybe Bool) (Maybe QName) [LamBinding] Expr [Declaration] | The |
PatternSynDef QName [Arg Name] (Pattern' Void) | Only for highlighting purposes |
UnquoteDecl MutualInfo [DefInfo] [QName] Expr | |
UnquoteDef [DefInfo] [QName] Expr | |
ScopedDecl ScopeInfo [Declaration] | scope annotation |
Eq Declaration Source | Does not compare |
Show Declaration Source | |
KillRange Declaration Source | |
HasRange Declaration Source | |
GetDefInfo Declaration Source | |
AnyAbstract Declaration Source | |
AllNames Declaration Source | |
ExprLike Declaration Source | |
ShowHead Declaration Source | |
UniverseBi Declaration RString Source | |
UniverseBi Declaration AmbiguousQName Source | |
UniverseBi Declaration ModuleName Source | |
UniverseBi Declaration QName Source | |
UniverseBi Declaration ModuleInfo Source | |
UniverseBi Declaration Pattern Source | |
UniverseBi Declaration TypedBinding Source | |
UniverseBi Declaration LamBinding Source | |
UniverseBi Declaration LetBinding Source | |
UniverseBi Declaration Declaration Source | |
UniverseBi Declaration Expr Source | |
ToAbstract NiceDeclaration Declaration Source | |
UniverseBi Declaration (Pattern' Void) Source | |
ToConcrete Declaration [Declaration] Source | |
ToConcrete (Constr Constructor) Declaration Source | |
ToAbstract [Declaration] [Declaration] Source |
type Renaming = Renaming' QName ModuleName Source
data ModuleApplication Source
SectionApp Telescope ModuleName [NamedArg Expr] |
|
RecordModuleIFS ModuleName | M {{...}} |
OptionsPragma [String] | |
BuiltinPragma String Expr | |
BuiltinNoDefPragma String QName | Builtins that do not come with a definition, but declare a name for an Agda concept. |
RewritePragma QName | |
CompiledPragma QName String | |
CompiledExportPragma QName String | |
CompiledDeclareDataPragma QName String | |
CompiledTypePragma QName String | |
CompiledDataPragma QName String [String] | |
CompiledEpicPragma QName String | |
CompiledJSPragma QName String | |
CompiledUHCPragma QName String | |
CompiledDataUHCPragma QName String [String] | |
NoSmashingPragma QName | |
StaticPragma QName | |
InlinePragma QName | |
DisplayPragma QName [NamedArg Pattern] Expr |
data LetBinding Source
Bindings that are valid in a let
.
LetBind LetInfo ArgInfo Name Expr Expr | LetBind info rel name type defn |
LetPatBind LetInfo Pattern Expr | Irrefutable pattern binding. |
LetApply ModuleInfo ModuleName ModuleApplication (Ren QName) (Ren ModuleName) ImportDirective |
|
LetOpen ModuleInfo ModuleName ImportDirective | only for highlighting and abstractToConcrete |
LetDeclaredVariable Name | Only used for highlighting. Refers to the first occurrence of
|
type TypeSignature = Declaration Source
Only Axiom
s.
type Constructor = TypeSignature Source
type Field = TypeSignature Source
data LamBinding Source
A lambda binding is either domain free or typed.
DomainFree ArgInfo Name | . |
DomainFull TypedBindings | . |
data TypedBindings Source
Typed bindings with hiding information.
TypedBindings Range (Arg TypedBinding) | . |
data TypedBinding Source
A typed binding. Appears in dependent function spaces, typed lambdas, and
telescopes. It might be tempting to simplify this to only bind a single
name at a time, and translate, say, (x y : A)
to (x : A)(y : A)
before type-checking. However, this would be slightly problematic:
- We would have to typecheck the type
A
several times. - If
A
contains a meta variable or hole, it would be duplicated by such a translation.
While 1. is only slightly inefficient, 2. would be an outright bug.
Duplicating A
could not be done naively, we would have to make sure
that the metas of the copy are aliases of the metas of the original.
TBind Range [WithHiding Name] Expr | As in telescope |
TLet Range [LetBinding] | E.g. |
type Telescope = [TypedBindings] Source
We could throw away where
clauses at this point and translate them to
let
. It's not obvious how to remember that the let
was really a
where
clause though, so for the time being we keep it here.
Clause | |
|
Functor Clause' Source | |
Foldable Clause' Source | |
Traversable Clause' Source | |
AllNames Clause Source | |
LHSToSpine Clause SpineClause Source | Clause instance. |
Reify NamedClause Clause Source | |
ToAbstract Clause Clause Source | |
Eq lhs => Eq (Clause' lhs) Source | |
Show lhs => Show (Clause' lhs) Source | |
KillRange a => KillRange (Clause' a) Source | |
HasRange a => HasRange (Clause' a) Source | |
ExprLike a => ExprLike (Clause' a) Source | |
ToAbstract (QNamed Clause) Clause Source | |
ToConcrete a LHS => ToConcrete (Clause' a) [Declaration] Source | |
ToAbstract [QNamed Clause] [Clause] Source |
type SpineClause = Clause' SpineLHS Source
The lhs of a clause in spine view (inside-out).
Projection patterns are contained in spLhsPats
,
represented as DefP d []
.
SpineLHS | |
|
The lhs of a clause in focused (projection-application) view (outside-in).
Projection patters are represented as LHSProj
s.
Eq LHS Source | |
Show LHS Source | |
KillRange LHS Source | |
HasRange LHS Source | |
AllNames Clause Source | |
ExprLike LHS Source | |
LHSToSpine LHS SpineLHS Source | LHS instance. |
LHSToSpine Clause SpineClause Source | Clause instance. |
ToConcrete LHS LHS Source | |
Reify NamedClause Clause Source | |
ToAbstract Clause Clause Source | |
ToAbstract LeftHandSide LHS Source | |
ToAbstract (QNamed Clause) Clause Source | |
ToAbstract [QNamed Clause] [Clause] Source |
The lhs minus with
-patterns in projection-application view.
Parameterised over the type e
of dot patterns.
LHSHead | The head applied to ordinary patterns. |
| |
LHSProj | Projection |
|
Functor LHSCore' Source | |
Foldable LHSCore' Source | |
Traversable LHSCore' Source | |
ToConcrete LHSCore Pattern Source | |
ToAbstract LHSCore (LHSCore' Expr) Source | |
Eq e => Eq (LHSCore' e) Source | |
Show e => Show (LHSCore' e) Source | |
KillRange e => KillRange (LHSCore' e) Source | |
HasRange (LHSCore' e) Source | |
ExprLike a => ExprLike (LHSCore' a) Source | |
ToAbstract (LHSCore' Expr) (LHSCore' Expr) Source |
class LHSToSpine a b where Source
Convert a focused lhs to spine view and back.
lhsToSpine :: a -> b Source
spineToLhs :: b -> a Source
LHSToSpine LHS SpineLHS Source | LHS instance. |
LHSToSpine Clause SpineClause Source | Clause instance. |
LHSToSpine a b => LHSToSpine [a] [b] Source | List instance (for clauses). |
lhsCoreApp :: LHSCore' e -> [NamedArg (Pattern' e)] -> LHSCore' e Source
Add applicative patterns (non-projection patterns) to the right.
lhsCoreAddSpine :: LHSCore' e -> [NamedArg (Pattern' e)] -> LHSCore' e Source
Add projection and applicative patterns to the right.
lhsCoreAllPatterns :: LHSCore' e -> [Pattern' e] Source
Used for checking pattern linearity.
lhsCoreToPattern :: LHSCore -> Pattern Source
Used in AbstractToConcrete.
Patterns
Parameterised over the type of dot patterns.
VarP Name | |
ConP ConPatInfo AmbiguousQName [NamedArg (Pattern' e)] | |
DefP PatInfo QName [NamedArg (Pattern' e)] | Defined pattern: function definition |
WildP PatInfo | Underscore pattern entered by user. Or generated at type checking for implicit arguments. |
AsP PatInfo Name (Pattern' e) | |
DotP PatInfo e | |
AbsurdP PatInfo | |
LitP Literal | |
PatternSynP PatInfo QName [NamedArg (Pattern' e)] | |
RecP PatInfo [FieldAssignment' (Pattern' e)] |
Functor Pattern' Source | |
Foldable Pattern' Source | |
Traversable Pattern' Source | |
ExpandPatternSynonyms Pattern Source | |
IsFlexiblePattern Pattern Source | |
UniverseBi Declaration Pattern Source | |
ToConcrete Pattern Pattern Source | |
UniverseBi Declaration (Pattern' Void) Source | |
ToAbstract Pattern (Pattern' Expr) Source | |
ToAbstract Pattern (Names, Pattern) Source | |
Eq e => Eq (Pattern' e) Source | |
Show e => Show (Pattern' e) Source | |
KillRange e => KillRange (Pattern' e) Source | |
SetRange (Pattern' a) Source | |
HasRange (Pattern' e) Source | |
IsProjP (Pattern' e) Source | |
ExprLike a => ExprLike (Pattern' a) Source | |
NamesIn (Pattern' a) Source | |
ToAbstract (Pattern' Expr) (Pattern' Expr) Source |
Check whether we are a projection pattern.
Extracts all the names which are declared in a Declaration
.
This does not include open public or let expressions, but it does
include local modules, where clauses and the names of extended
lambdas.
AllNames QName Source | |
AllNames RHS Source | |
AllNames Clause Source | |
AllNames TypedBinding Source | |
AllNames TypedBindings Source | |
AllNames LamBinding Source | |
AllNames LetBinding Source | |
AllNames ModuleApplication Source | |
AllNames Declaration Source | |
AllNames Expr Source | |
AllNames CallInfo Source | |
AllNames CallPath Source | |
AllNames a => AllNames [a] Source | |
AllNames a => AllNames (Maybe a) Source | |
AllNames a => AllNames (Arg a) Source | |
(AllNames a, AllNames b) => AllNames (a, b) Source | |
AllNames a => AllNames (Named name a) Source |
axiomName :: Declaration -> QName Source
The name defined by the given axiom.
Precondition: The declaration has to be a (scoped) Axiom
.
class AnyAbstract a where Source
Are we in an abstract block?
In that case some definition is abstract.
anyAbstract :: a -> Bool Source
AnyAbstract Declaration Source | |
AnyAbstract a => AnyAbstract [a] Source |
nameExpr :: AbstractName -> Expr Source
Turn an AbstractName
to an expression.
patternToExpr :: Pattern -> Expr Source
type PatternSynDefns = Map QName PatternSynDefn Source
lambdaLiftExpr :: [Name] -> Expr -> Expr Source
class SubstExpr a where Source
SubstExpr Name Source | |
SubstExpr ModuleName Source | |
SubstExpr TypedBinding Source | |
SubstExpr TypedBindings Source | |
SubstExpr LetBinding Source | |
SubstExpr Assign Source | |
SubstExpr Expr Source | |
SubstExpr a => SubstExpr [a] Source | |
SubstExpr a => SubstExpr (Arg a) Source | |
(SubstExpr a, SubstExpr b) => SubstExpr (Either a b) Source | |
(SubstExpr a, SubstExpr b) => SubstExpr (a, b) Source | |
SubstExpr a => SubstExpr (Named name a) Source |
insertImplicitPatSynArgs :: HasRange a => (Range -> a) -> Range -> [Arg Name] -> [NamedArg a] -> Maybe ([(Name, a)], [Arg Name]) Source
module Agda.Syntax.Abstract.Name