Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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).
Synopsis
- data WhereDeclarationsSpine = WhereDeclsS (Maybe DeclarationSpine)
- data RHSSpine
- data ClauseSpine = ClauseS RHSSpine WhereDeclarationsSpine
- data DeclarationSpine
- = AxiomS
- | GeneralizeS
- | FieldS
- | PrimitiveS
- | MutualS [DeclarationSpine]
- | SectionS [DeclarationSpine]
- | ApplyS
- | ImportS
- | PragmaS
- | OpenS
- | FunDefS [ClauseSpine]
- | DataSigS
- | DataDefS
- | RecSigS
- | RecDefS [DeclarationSpine]
- | PatternSynDefS
- | UnquoteDeclS
- | UnquoteDefS
- | UnquoteDataS
- | ScopedDeclS [DeclarationSpine]
- class SubstExpr a where
- type PatternSynDefns = Map QName PatternSynDefn
- type PatternSynDefn = ([Arg Name], Pattern' Void)
- class NameToExpr a where
- nameToExpr :: a -> Expr
- class AnyAbstract a where
- anyAbstract :: a -> Bool
- type HoleContent = HoleContent' () BindName Pattern Expr
- type Patterns = [NamedArg Pattern]
- type Pattern = Pattern' Expr
- type NAPs1 e = List1 (NamedArg (Pattern' e))
- type NAPs e = [NamedArg (Pattern' e)]
- data Pattern' e
- = VarP BindName
- | ConP ConPatInfo AmbiguousQName (NAPs e)
- | ProjP PatInfo ProjOrigin AmbiguousQName
- | DefP PatInfo AmbiguousQName (NAPs e)
- | WildP PatInfo
- | AsP PatInfo BindName (Pattern' e)
- | DotP PatInfo e
- | AbsurdP PatInfo
- | LitP PatInfo Literal
- | PatternSynP PatInfo AmbiguousQName (NAPs e)
- | RecP PatInfo [FieldAssignment' (Pattern' e)]
- | EqualP PatInfo [(e, e)]
- | WithP PatInfo (Pattern' e)
- | AnnP PatInfo e (Pattern' e)
- type LHSCore = LHSCore' Expr
- data LHSCore' e
- data LHS = LHS {}
- data SpineLHS = SpineLHS {}
- data RHS
- type WithExpr = WithExpr' Expr
- type WithExpr' e = Named BindName (Arg e)
- type RewriteEqn = RewriteEqn' QName BindName Pattern Expr
- type SpineClause = Clause' SpineLHS
- type Clause = Clause' LHS
- data WhereDeclarations = WhereDecls {}
- data Clause' lhs = Clause {
- clauseLHS :: lhs
- clauseStrippedPats :: [ProblemEq]
- clauseRHS :: RHS
- clauseWhereDecls :: WhereDeclarations
- clauseCatchall :: Bool
- data ProblemEq = ProblemEq {
- problemInPat :: Pattern
- problemInst :: Term
- problemType :: Dom Type
- data DataDefParams = DataDefParams {}
- data GeneralizeTelescope = GeneralizeTel {}
- type Telescope = [TypedBinding]
- type Telescope1 = List1 TypedBinding
- data TypedBinding
- data TypedBindingInfo = TypedBindingInfo {}
- data LamBinding
- type Binder = Binder' BindName
- data Binder' a = Binder {
- binderPattern :: Maybe Pattern
- binderName :: a
- type TacticAttr = Maybe Expr
- type Field = TypeSignature
- type Constructor = TypeSignature
- type TypeSignature = Declaration
- data LetBinding
- data Pragma
- = OptionsPragma [String]
- | BuiltinPragma RString ResolvedName
- | BuiltinNoDefPragma RString KindOfName QName
- | RewritePragma Range [QName]
- | CompilePragma RString QName String
- | StaticPragma QName
- | EtaPragma QName
- | InjectivePragma QName
- | InlinePragma Bool QName
- | NotProjectionLikePragma QName
- | DisplayPragma QName [NamedArg Pattern] Expr
- data ModuleApplication
- type ImportedName = ImportedName' QName ModuleName
- type Renaming = Renaming' QName ModuleName
- type ImportDirective = ImportDirective' QName ModuleName
- type DefInfo = DefInfo' Expr
- data Declaration
- = Axiom KindOfName DefInfo ArgInfo (Maybe [Occurrence]) QName Type
- | Generalize (Set QName) DefInfo ArgInfo QName Type
- | Field DefInfo QName (Arg Type)
- | Primitive DefInfo QName (Arg Type)
- | Mutual MutualInfo [Declaration]
- | Section Range ModuleName GeneralizeTelescope [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 GeneralizeTelescope Type
- | DataDef DefInfo QName UniverseCheck DataDefParams [Constructor]
- | RecSig DefInfo QName GeneralizeTelescope Type
- | RecDef DefInfo QName UniverseCheck RecordDirectives DataDefParams Type [Declaration]
- | PatternSynDef QName [Arg BindName] (Pattern' Void)
- | UnquoteDecl MutualInfo [DefInfo] [QName] Expr
- | UnquoteDef [DefInfo] [QName] Expr
- | UnquoteData [DefInfo] QName UniverseCheck [DefInfo] [QName] Expr
- | ScopedDecl ScopeInfo [Declaration]
- type RecordDirectives = RecordDirectives' QName
- data ScopeCopyInfo = ScopeCopyInfo {
- renModules :: Ren ModuleName
- renNames :: Ren QName
- type Ren a = Map a (List1 a)
- type RecordAssigns = [RecordAssign]
- type RecordAssign = Either Assign ModuleName
- type Assigns = [Assign]
- type Assign = FieldAssignment' Expr
- data Expr
- = Var Name
- | Def' QName Suffix
- | Proj ProjOrigin AmbiguousQName
- | Con AmbiguousQName
- | PatternSyn AmbiguousQName
- | Macro QName
- | Lit ExprInfo Literal
- | QuestionMark MetaInfo InteractionId
- | Underscore MetaInfo
- | Dot ExprInfo Expr
- | App AppInfo Expr (NamedArg Expr)
- | WithApp ExprInfo Expr [Expr]
- | Lam ExprInfo LamBinding Expr
- | AbsurdLam ExprInfo Hiding
- | ExtendedLam ExprInfo DefInfo Erased QName (List1 Clause)
- | Pi ExprInfo Telescope1 Type
- | Generalized (Set QName) Type
- | Fun ExprInfo (Arg Type) Type
- | Let ExprInfo (List1 LetBinding) Expr
- | Rec ExprInfo RecordAssigns
- | RecUpdate ExprInfo Expr Assigns
- | ScopedExpr ScopeInfo Expr
- | Quote ExprInfo
- | QuoteTerm ExprInfo
- | Unquote ExprInfo
- | DontCare Expr
- type Type = Expr
- type Args = [NamedArg Expr]
- newtype BindName = BindName {}
- pattern Def :: QName -> Expr
- mkBindName :: Name -> BindName
- generalized :: Set QName -> Type -> Type
- initCopyInfo :: ScopeCopyInfo
- mkBinder :: a -> Binder' a
- mkBinder_ :: Name -> Binder
- extractPattern :: Binder' a -> Maybe (Pattern, a)
- mkDomainFree :: NamedArg Binder -> LamBinding
- defaultTbInfo :: TypedBindingInfo
- mkTBind :: Range -> List1 (NamedArg Binder) -> Type -> TypedBinding
- mkTLet :: Range -> [LetBinding] -> Maybe TypedBinding
- mkPi :: ExprInfo -> Telescope -> Type -> Type
- noDataDefParams :: DataDefParams
- noWhereDecls :: WhereDeclarations
- axiomName :: Declaration -> QName
- app :: Expr -> [NamedArg Expr] -> Expr
- mkLet :: ExprInfo -> [LetBinding] -> Expr -> Expr
- patternToExpr :: Pattern -> Expr
- lambdaLiftExpr :: [Name] -> Expr -> Expr
- insertImplicitPatSynArgs :: HasRange a => (Range -> a) -> Range -> [Arg Name] -> [NamedArg a] -> Maybe ([(Name, a)], [Arg Name])
- declarationSpine :: Declaration -> DeclarationSpine
- clauseSpine :: Clause -> ClauseSpine
- rhsSpine :: RHS -> RHSSpine
- whereDeclarationsSpine :: WhereDeclarations -> WhereDeclarationsSpine
- module Agda.Syntax.Abstract.Name
Documentation
data WhereDeclarationsSpine Source #
Spines corresponding to WhereDeclarations
values.
Instances
Show WhereDeclarationsSpine Source # | |
Defined in Agda.Syntax.Abstract showsPrec :: Int -> WhereDeclarationsSpine -> ShowS # show :: WhereDeclarationsSpine -> String # showList :: [WhereDeclarationsSpine] -> ShowS # |
Right-hand side spines.
data ClauseSpine Source #
Clause spines.
Instances
Show ClauseSpine Source # | |
Defined in Agda.Syntax.Abstract showsPrec :: Int -> ClauseSpine -> ShowS # show :: ClauseSpine -> String # showList :: [ClauseSpine] -> ShowS # |
data DeclarationSpine Source #
Declaration spines. Used in debugging to make it easy to see
where constructors such as ScopedDecl
and Mutual
are placed.
Instances
Show DeclarationSpine Source # | |
Defined in Agda.Syntax.Abstract showsPrec :: Int -> DeclarationSpine -> ShowS # show :: DeclarationSpine -> String # showList :: [DeclarationSpine] -> ShowS # |
class SubstExpr a where Source #
Nothing
Instances
SubstExpr Expr Source # | |
SubstExpr ModuleName Source # | |
Defined in Agda.Syntax.Abstract substExpr :: [(Name, Expr)] -> ModuleName -> ModuleName Source # | |
SubstExpr Name Source # | |
SubstExpr a => SubstExpr (Arg a) Source # | |
SubstExpr a => SubstExpr (FieldAssignment' a) Source # | |
Defined in Agda.Syntax.Abstract substExpr :: [(Name, Expr)] -> FieldAssignment' a -> FieldAssignment' a Source # | |
SubstExpr a => SubstExpr (List1 a) Source # | |
SubstExpr a => SubstExpr (Maybe a) Source # | |
SubstExpr a => SubstExpr [a] Source # | |
SubstExpr a => SubstExpr (Named name a) Source # | |
(SubstExpr a, SubstExpr b) => SubstExpr (Either a b) Source # | |
(SubstExpr a, SubstExpr b) => SubstExpr (a, b) Source # | |
type PatternSynDefns = Map QName PatternSynDefn Source #
class NameToExpr a where Source #
Turn a name into an expression.
nameToExpr :: a -> Expr Source #
Instances
NameToExpr AbstractName Source # | Turn an |
Defined in Agda.Syntax.Abstract nameToExpr :: AbstractName -> Expr Source # | |
NameToExpr ResolvedName Source # | Turn a Assumes name is not |
Defined in Agda.Syntax.Abstract nameToExpr :: ResolvedName -> Expr Source # |
class AnyAbstract a where Source #
Are we in an abstract block?
In that case some definition is abstract.
anyAbstract :: a -> Bool Source #
Instances
AnyAbstract Declaration Source # | |
Defined in Agda.Syntax.Abstract anyAbstract :: Declaration -> Bool Source # | |
AnyAbstract a => AnyAbstract [a] Source # | |
Defined in Agda.Syntax.Abstract anyAbstract :: [a] -> Bool Source # |
type HoleContent = HoleContent' () BindName Pattern Expr Source #
Parameterised over the type of dot patterns.
VarP BindName | |
ConP ConPatInfo AmbiguousQName (NAPs e) | |
ProjP PatInfo ProjOrigin AmbiguousQName | Destructor pattern |
DefP PatInfo AmbiguousQName (NAPs e) | Defined pattern: function definition |
WildP PatInfo | Underscore pattern entered by user. Or generated at type checking for implicit arguments. |
AsP PatInfo BindName (Pattern' e) | |
DotP PatInfo e | Dot pattern |
AbsurdP PatInfo | |
LitP PatInfo Literal | |
PatternSynP PatInfo AmbiguousQName (NAPs e) | |
RecP PatInfo [FieldAssignment' (Pattern' e)] | |
EqualP PatInfo [(e, e)] | |
WithP PatInfo (Pattern' e) |
|
AnnP PatInfo e (Pattern' e) | Pattern with type annotation |
Instances
The lhs in projection-application and with-pattern view.
Parameterised over the type e
of dot patterns.
LHSHead | The head applied to ordinary patterns. |
| |
LHSProj | Projection. |
| |
LHSWith | With patterns. |
Instances
The lhs of a clause in focused (projection-application) view (outside-in).
Projection patters are represented as LHSProj
s.
Instances
The lhs of a clause in spine view (inside-out).
Projection patterns are contained in spLhsPats
,
represented as ProjP d
.
Instances
RHS | |
AbsurdRHS | |
WithRHS QName [WithExpr] [Clause] | The |
RewriteRHS | |
|
Instances
type RewriteEqn = RewriteEqn' QName BindName Pattern Expr Source #
type SpineClause = Clause' SpineLHS Source #
data WhereDeclarations Source #
WhereDecls | |
|
Instances
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 | |
|
Instances
A user pattern together with an internal term that it should be equal to after splitting is complete. Special cases: * User pattern is a variable but internal term isn't: this will be turned into an as pattern. * User pattern is a dot pattern: this pattern won't trigger any splitting but will be checked for equality after all splitting is complete and as patterns have been bound. * User pattern is an absurd pattern: emptiness of the type will be checked after splitting is complete. * User pattern is an annotated wildcard: type annotation will be checked after splitting is complete.
ProblemEq | |
|
Instances
data DataDefParams Source #
DataDefParams | |
|
Instances
data GeneralizeTelescope Source #
GeneralizeTel | |
|
Instances
type Telescope = [TypedBinding] Source #
type Telescope1 = List1 TypedBinding Source #
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 TypedBindingInfo (List1 (NamedArg Binder)) Type | As in telescope |
TLet Range (List1 LetBinding) | E.g. |
Instances
data TypedBindingInfo Source #
Extra information that is attached to a typed binding, that plays a
role during type checking but strictly speaking is not part of the
name : type
" relation which a makes up a binding.
TypedBindingInfo | |
|
Instances
data LamBinding Source #
A lambda binding is either domain free or typed.
DomainFree TacticAttr (NamedArg Binder) | . |
DomainFull TypedBinding | . |
Instances
Binder | |
|
Instances
type TacticAttr = Maybe Expr Source #
type Field = TypeSignature Source #
type Constructor = TypeSignature Source #
type TypeSignature = Declaration Source #
Only Axiom
s.
data LetBinding Source #
Bindings that are valid in a let
.
LetBind LetInfo ArgInfo BindName Type 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 BindName | Only used for highlighting. Refers to the first occurrence of
|
Instances
OptionsPragma [String] | |
BuiltinPragma RString ResolvedName |
|
BuiltinNoDefPragma RString KindOfName QName | Builtins that do not come with a definition, but declare a name for an Agda concept. |
RewritePragma Range [QName] | Range is range of REWRITE keyword. |
CompilePragma RString QName String | |
StaticPragma QName | |
EtaPragma QName | For coinductive records, use pragma instead of regular
|
InjectivePragma QName | |
InlinePragma Bool QName | |
NotProjectionLikePragma QName | |
DisplayPragma QName [NamedArg Pattern] Expr |
Instances
data ModuleApplication Source #
SectionApp Telescope ModuleName [NamedArg Expr] |
|
RecordModuleInstance ModuleName | M {{...}} |
Instances
type ImportedName = ImportedName' QName ModuleName Source #
data Declaration Source #
Instances
data ScopeCopyInfo Source #
Instances
type RecordAssigns = [RecordAssign] Source #
type RecordAssign = Either Assign ModuleName Source #
type Assign = FieldAssignment' Expr Source #
Record field assignment f = e
.
Expressions after scope checking (operators parsed, names resolved).
Var Name | Bound variable. |
Def' QName Suffix | Constant: axiom, function, data or record type, with a possible suffix. |
Proj ProjOrigin AmbiguousQName | Projection (overloaded). |
Con AmbiguousQName | Constructor (overloaded). |
PatternSyn AmbiguousQName | Pattern synonym. |
Macro QName | Macro. |
Lit ExprInfo 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 AppInfo Expr (NamedArg Expr) | Ordinary (binary) application. |
WithApp ExprInfo Expr [Expr] | With application. |
Lam ExprInfo LamBinding Expr |
|
AbsurdLam ExprInfo Hiding |
|
ExtendedLam ExprInfo DefInfo Erased QName (List1 Clause) | |
Pi ExprInfo Telescope1 Type | Dependent function space |
Generalized (Set QName) Type | Like a Pi, but the ordering is not known |
Fun ExprInfo (Arg Type) Type | Non-dependent function space. |
Let ExprInfo (List1 LetBinding) Expr |
|
Rec ExprInfo RecordAssigns | Record construction. |
RecUpdate ExprInfo Expr Assigns | Record update. |
ScopedExpr ScopeInfo Expr | Scope annotation. |
Quote ExprInfo | Quote an identifier |
QuoteTerm ExprInfo | Quote a term. |
Unquote ExprInfo | The splicing construct: unquote ... |
DontCare Expr | For printing |
Instances
Types are just expressions. Use this type synonym for hinting that an expression should be a type.
A name in a binding position: we also compare the nameConcrete when comparing the binders for equality.
With --caching
on we compare abstract syntax to determine if we can
reuse previous typechecking results: during that comparison two
names can have the same nameId but be semantically different,
e.g. in {_ : A} -> ..
vs. {r : A} -> ..
.
Instances
mkBindName :: Name -> BindName Source #
generalized :: Set QName -> Type -> Type Source #
Smart constructor for Generalized
.
mkDomainFree :: NamedArg Binder -> LamBinding Source #
mkTLet :: Range -> [LetBinding] -> Maybe TypedBinding Source #
axiomName :: Declaration -> QName Source #
The name defined by the given axiom.
Precondition: The declaration has to be a (scoped) Axiom
.
patternToExpr :: Pattern -> Expr Source #
insertImplicitPatSynArgs :: HasRange a => (Range -> a) -> Range -> [Arg Name] -> [NamedArg a] -> Maybe ([(Name, a)], [Arg Name]) Source #
declarationSpine :: Declaration -> DeclarationSpine Source #
The declaration spine corresponding to a declaration.
clauseSpine :: Clause -> ClauseSpine Source #
The clause spine corresponding to a clause.
whereDeclarationsSpine :: WhereDeclarations -> WhereDeclarationsSpine Source #
The spine corresponding to a WhereDeclarations
value.
module Agda.Syntax.Abstract.Name