| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Agda.Syntax.Abstract
Contents
Description
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 ProjOrigin AmbiguousQName
- | Con AmbiguousQName
- | PatternSyn QName
- | Macro QName
- | Lit Literal
- | QuestionMark MetaInfo InteractionId
- | Underscore MetaInfo
- | Dot ExprInfo Expr
- | App ExprInfo Expr (NamedArg Expr)
- | WithApp ExprInfo Expr [Expr]
- | Lam LamInfo LamBinding Expr
- | AbsurdLam LamInfo Hiding
- | ExtendedLam LamInfo 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 ScopeCopyInfo = ScopeCopyInfo {
- renModules :: Ren ModuleName
- renNames :: Ren QName
- initCopyInfo :: ScopeCopyInfo
- data Declaration
- = Axiom Axiom DefInfo ArgInfo (Maybe [Occurrence]) QName Expr
- | Field DefInfo QName (Arg Expr)
- | Primitive DefInfo QName Expr
- | Mutual MutualInfo [Declaration]
- | Section ModuleInfo ModuleName [TypedBindings] [Declaration]
- | Apply ModuleInfo ModuleName ModuleApplication ScopeCopyInfo 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
- 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
- | CompilePragma String QName String
- | CompiledPragma QName String
- | CompiledExportPragma QName String
- | CompiledTypePragma QName String
- | CompiledDataPragma QName String [String]
- | CompiledJSPragma QName String
- | CompiledUHCPragma QName String
- | CompiledDataUHCPragma QName String [String]
- | StaticPragma QName
- | EtaPragma QName
- | InjectivePragma 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 NamedDotPattern = NamedDot Name Term Type
- data StrippedDotPattern = StrippedDot Expr Term Type
- data Clause' lhs = Clause {
- clauseLHS :: lhs
- clauseNamedDots :: [NamedDotPattern]
- clauseStrippedDots :: [StrippedDotPattern]
- clauseRHS :: RHS
- clauseWhereDecls :: [Declaration]
- clauseCatchall :: Bool
- type Clause = Clause' LHS
- type SpineClause = Clause' SpineLHS
- data RHS
- = RHS {
- rhsExpr :: Expr
- rhsConcrete :: Maybe Expr
- | AbsurdRHS
- | WithRHS QName [Expr] [Clause]
- | RewriteRHS {
- rewriteExprs :: [(QName, Expr)]
- rewriteRHS :: RHS
- rewriteWhereDecls :: [Declaration]
- = 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 :: AmbiguousQName
- lhsFocus :: NamedArg (LHSCore' e)
- lhsPatsRight :: [NamedArg (Pattern' e)]
- = LHSHead {
- type LHSCore = LHSCore' Expr
- class LHSToSpine a b where
- lhsCoreToSpine :: LHSCore' e -> QNamed [NamedArg (Pattern' e)]
- spineToLhsCore :: IsProjP e => QNamed [NamedArg (Pattern' e)] -> LHSCore' e
- lhsCoreApp :: IsProjP e => LHSCore' e -> [NamedArg (Pattern' e)] -> LHSCore' e
- lhsCoreAddSpine :: IsProjP e => 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)]
- | ProjP PatInfo ProjOrigin AmbiguousQName
- | DefP PatInfo AmbiguousQName [NamedArg (Pattern' e)]
- | WildP PatInfo
- | AsP PatInfo Name (Pattern' e)
- | DotP PatInfo Origin 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 MaybePostfixProjP a where
- class AllNames a where
- axiomName :: Declaration -> QName
- class AnyAbstract a where
- 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).
Constructors
| Var Name | Bound variable. |
| Def QName | Constant: axiom, function, data or record type. |
| Proj ProjOrigin AmbiguousQName | Projection (overloaded). |
| Con AmbiguousQName | Constructor (overloaded). |
| 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). |
| Dot ExprInfo Expr |
|
| App ExprInfo Expr (NamedArg Expr) | Ordinary (binary) application. |
| WithApp ExprInfo Expr [Expr] | With application. |
| Lam LamInfo LamBinding Expr |
|
| AbsurdLam LamInfo Hiding |
|
| ExtendedLam LamInfo 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 |
Instances
type Assign = FieldAssignment' Expr #
Record field assignment f = e.
type RecordAssign = Either Assign ModuleName #
type RecordAssigns = [RecordAssign] #
Is a type signature a postulate or a function signature?
data ScopeCopyInfo #
Constructors
| ScopeCopyInfo | |
Fields
| |
Instances
data Declaration #
Constructors
| Axiom Axiom DefInfo ArgInfo (Maybe [Occurrence]) QName Expr | Type signature (can be irrelevant, but not hidden). The fourth argument contains an optional assignment of polarities to arguments. |
| 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 ScopeCopyInfo 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 |
| 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 |
Instances
class GetDefInfo a where #
Minimal complete definition
Methods
getDefInfo :: a -> Maybe DefInfo #
Instances
type Renaming = Renaming' QName ModuleName #
type ImportedName = ImportedName' QName ModuleName #
data ModuleApplication #
Constructors
| SectionApp Telescope ModuleName [NamedArg Expr] |
|
| RecordModuleIFS ModuleName | M {{...}} |
Constructors
| 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 | |
| CompilePragma String QName String | |
| CompiledPragma QName String | |
| CompiledExportPragma QName String | |
| CompiledTypePragma QName String | |
| CompiledDataPragma QName String [String] | |
| CompiledJSPragma QName String | |
| CompiledUHCPragma QName String | |
| CompiledDataUHCPragma QName String [String] | |
| StaticPragma QName | |
| EtaPragma QName | For coinductive records, use pragma instead of regular
|
| InjectivePragma QName | |
| InlinePragma QName | |
| DisplayPragma QName [NamedArg Pattern] Expr |
data LetBinding #
Bindings that are valid in a let.
Constructors
| LetBind LetInfo ArgInfo Name Expr Expr | LetBind info rel name type defn |
| LetPatBind LetInfo Pattern Expr | Irrefutable pattern binding. |
| LetApply ModuleInfo ModuleName ModuleApplication ScopeCopyInfo ImportDirective |
|
| LetOpen ModuleInfo ModuleName ImportDirective | only for highlighting and abstractToConcrete |
| LetDeclaredVariable Name | Only used for highlighting. Refers to the first occurrence of
|
Instances
type TypeSignature = Declaration #
Only Axioms.
type Constructor = TypeSignature #
type Field = TypeSignature #
data LamBinding #
A lambda binding is either domain free or typed.
Constructors
| DomainFree ArgInfo Name | . |
| DomainFull TypedBindings | . |
data TypedBindings #
Typed bindings with hiding information.
Constructors
| TypedBindings Range (Arg TypedBinding) | . |
Instances
data TypedBinding #
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
Aseveral times. - If
Acontains 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.
Constructors
| TBind Range [WithHiding Name] Expr | As in telescope |
| TLet Range [LetBinding] | E.g. |
Instances
type Telescope = [TypedBindings] #
data NamedDotPattern #
Instances
data StrippedDotPattern #
Constructors
| StrippedDot Expr Term Type |
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.
Constructors
| Clause | |
Fields
| |
Instances
| Functor Clause' # | |
| Foldable Clause' # | |
| Traversable Clause' # | |
| AllNames Clause # | |
| LHSToSpine Clause SpineClause # | Clause instance. |
| Reify NamedClause Clause # | |
| ToAbstract Clause Clause # | |
| Eq lhs => Eq (Clause' lhs) # | |
| Data lhs => Data (Clause' lhs) # | |
| Show lhs => Show (Clause' lhs) # | |
| KillRange a => KillRange (Clause' a) # | |
| HasRange a => HasRange (Clause' a) # | |
| ExprLike a => ExprLike (Clause' a) # | |
| Reify (QNamed Clause) Clause # | |
| ToAbstract (QNamed Clause) Clause # | |
| ToConcrete a LHS => ToConcrete (Clause' a) [Declaration] # | |
| ToAbstract [QNamed Clause] [Clause] # | |
type SpineClause = Clause' SpineLHS #
Constructors
| RHS | |
| AbsurdRHS | |
| WithRHS QName [Expr] [Clause] | The |
| RewriteRHS | |
Fields
| |
The lhs of a clause in spine view (inside-out).
Projection patterns are contained in spLhsPats,
represented as ProjP d.
Constructors
| SpineLHS | |
Fields
| |
The lhs of a clause in focused (projection-application) view (outside-in).
Projection patters are represented as LHSProjs.
Constructors
| LHS | |
Instances
| Eq LHS # | |
| Data LHS # | |
| Show LHS # | |
| KillRange LHS # | |
| HasRange LHS # | |
| AllNames Clause # | |
| ExprLike LHS # | |
| LHSToSpine LHS SpineLHS # | LHS instance. |
| LHSToSpine Clause SpineClause # | Clause instance. |
| ToConcrete LHS LHS # | |
| Reify NamedClause Clause # | |
| ToAbstract Clause Clause # | |
| ToAbstract LeftHandSide LHS # | |
| Reify (QNamed Clause) Clause # | |
| ToAbstract (QNamed Clause) Clause # | |
| ToAbstract [QNamed Clause] [Clause] # | |
The lhs minus with-patterns in projection-application view.
Parameterised over the type e of dot patterns.
Constructors
| LHSHead | The head applied to ordinary patterns. |
Fields
| |
| LHSProj | Projection |
Fields
| |
Instances
| Functor LHSCore' # | |
| Foldable LHSCore' # | |
| Traversable LHSCore' # | |
| ToConcrete LHSCore Pattern # | |
| ToAbstract LHSCore (LHSCore' Expr) # | |
| Eq e => Eq (LHSCore' e) # | |
| Data e => Data (LHSCore' e) # | |
| Show e => Show (LHSCore' e) # | |
| KillRange e => KillRange (LHSCore' e) # | |
| HasRange (LHSCore' e) # | |
| ExprLike a => ExprLike (LHSCore' a) # | |
| ToAbstract (LHSCore' Expr) (LHSCore' Expr) # | |
class LHSToSpine a b where #
Convert a focused lhs to spine view and back.
Minimal complete definition
Instances
| LHSToSpine LHS SpineLHS # | LHS instance. |
| LHSToSpine Clause SpineClause # | Clause instance. |
| LHSToSpine a b => LHSToSpine [a] [b] # | List instance (for clauses). |
lhsCoreApp :: IsProjP e => LHSCore' e -> [NamedArg (Pattern' e)] -> LHSCore' e #
Add applicative patterns (non-projection patterns) to the right.
lhsCoreAddSpine :: IsProjP e => LHSCore' e -> [NamedArg (Pattern' e)] -> LHSCore' e #
Add projection and applicative patterns to the right.
lhsCoreAllPatterns :: LHSCore' e -> [Pattern' e] #
Used for checking pattern linearity.
lhsCoreToPattern :: LHSCore -> Pattern #
Used in AbstractToConcrete.
Patterns
Parameterised over the type of dot patterns.
Constructors
| VarP Name | |
| ConP ConPatInfo AmbiguousQName [NamedArg (Pattern' e)] | |
| ProjP PatInfo ProjOrigin AmbiguousQName | Destructor pattern |
| DefP PatInfo AmbiguousQName [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 Origin e | Dot pattern |
| AbsurdP PatInfo | |
| LitP Literal | |
| PatternSynP PatInfo QName [NamedArg (Pattern' e)] | |
| RecP PatInfo [FieldAssignment' (Pattern' e)] |
Instances
| Functor Pattern' # | |
| Foldable Pattern' # | |
| Traversable Pattern' # | |
| MapNamedArgPattern NAP # | |
| ExpandPatternSynonyms Pattern # | |
| IsFlexiblePattern Pattern # | |
| UniverseBi Declaration Pattern # | |
| ToConcrete Pattern Pattern # | |
| UniverseBi Declaration (Pattern' Void) # | |
| APatternLike a (Pattern' a) # | |
| ToAbstract Pattern (Pattern' Expr) # | |
| ToAbstract Pattern (Names, Pattern) # | |
| Eq e => Eq (Pattern' e) # | |
| Data e => Data (Pattern' e) # | |
| Show e => Show (Pattern' e) # | |
| KillRange e => KillRange (Pattern' e) # | |
| SetRange (Pattern' a) # | |
| HasRange (Pattern' e) # | |
| IsProjP (Pattern' e) # | |
| IsProjP e => MaybePostfixProjP (Pattern' e) # | |
| ExprLike a => ExprLike (Pattern' a) # | |
| NamesIn (Pattern' a) # | |
| ToAbstract (Pattern' Expr) (Pattern' Expr) # | |
class MaybePostfixProjP a where #
Minimal complete definition
Methods
maybePostfixProjP :: a -> Maybe (ProjOrigin, AmbiguousQName) #
Instances
| MaybePostfixProjP a => MaybePostfixProjP (Arg a) # | |
| IsProjP e => MaybePostfixProjP (Pattern' e) # | |
| MaybePostfixProjP a => MaybePostfixProjP (Named n a) # | |
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.
Minimal complete definition
Instances
| AllNames QName # | |
| AllNames RHS # | |
| AllNames Clause # | |
| AllNames TypedBinding # | |
| AllNames TypedBindings # | |
| AllNames LamBinding # | |
| AllNames LetBinding # | |
| AllNames ModuleApplication # | |
| AllNames Declaration # | |
| AllNames Expr # | |
| AllNames CallInfo # | |
| AllNames CallPath # | |
| AllNames a => AllNames [a] # | |
| AllNames a => AllNames (Maybe a) # | |
| AllNames a => AllNames (Arg a) # | |
| (AllNames a, AllNames b) => AllNames (a, b) # | |
| AllNames a => AllNames (Named name a) # | |
axiomName :: Declaration -> QName #
The name defined by the given axiom.
Precondition: The declaration has to be a (scoped) Axiom.
class AnyAbstract a where #
Are we in an abstract block?
In that case some definition is abstract.
Minimal complete definition
Methods
anyAbstract :: a -> Bool #
Instances
| AnyAbstract Declaration # | |
| AnyAbstract a => AnyAbstract [a] # | |
nameExpr :: AbstractName -> Expr #
Turn an AbstractName to an expression.
patternToExpr :: Pattern -> Expr #
type PatternSynDefns = Map QName PatternSynDefn #
lambdaLiftExpr :: [Name] -> Expr -> Expr #
Minimal complete definition
Instances
| SubstExpr Name # | |
| SubstExpr ModuleName # | |
| SubstExpr TypedBinding # | |
| SubstExpr TypedBindings # | |
| SubstExpr LetBinding # | |
| SubstExpr Assign # | |
| SubstExpr Expr # | |
| SubstExpr a => SubstExpr [a] # | |
| SubstExpr a => SubstExpr (Arg a) # | |
| (SubstExpr a, SubstExpr b) => SubstExpr (Either a b) # | |
| (SubstExpr a, SubstExpr b) => SubstExpr (a, b) # | |
| SubstExpr a => SubstExpr (Named name a) # | |
insertImplicitPatSynArgs :: HasRange a => (Range -> a) -> Range -> [Arg Name] -> [NamedArg a] -> Maybe ([(Name, a)], [Arg Name]) #
module Agda.Syntax.Abstract.Name