Safe Haskell | None |
---|---|
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
- 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 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
- | 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 Expr
- | Generalize (Set QName) DefInfo ArgInfo QName Expr
- | Field DefInfo QName (Arg Expr)
- | Primitive DefInfo QName (Arg Expr)
- | 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 Expr
- | DataDef DefInfo QName UniverseCheck DataDefParams [Constructor]
- | RecSig DefInfo QName GeneralizeTelescope Expr
- | RecDef DefInfo QName UniverseCheck RecordDirectives DataDefParams Expr [Declaration]
- | PatternSynDef QName [Arg BindName] (Pattern' Void)
- | UnquoteDecl MutualInfo [DefInfo] [QName] Expr
- | UnquoteDef [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 Expr
- | Generalized (Set QName) Expr
- | Fun ExprInfo (Arg Expr) Expr
- | Let ExprInfo (List1 LetBinding) Expr
- | ETel Telescope
- | Rec ExprInfo RecordAssigns
- | RecUpdate ExprInfo Expr Assigns
- | ScopedExpr ScopeInfo Expr
- | Quote ExprInfo
- | QuoteTerm ExprInfo
- | Unquote ExprInfo
- | DontCare Expr
- type Args = [NamedArg Expr]
- newtype BindName = BindName {}
- pattern Def :: QName -> Expr
- mkBindName :: Name -> BindName
- generalized :: Set QName -> Expr -> Expr
- initCopyInfo :: ScopeCopyInfo
- mkBinder :: a -> Binder' a
- mkBinder_ :: Name -> Binder
- extractPattern :: Binder' a -> Maybe (Pattern, a)
- mkDomainFree :: NamedArg Binder -> LamBinding
- mkTBind :: Range -> List1 (NamedArg Binder) -> Expr -> TypedBinding
- mkTLet :: Range -> [LetBinding] -> Maybe TypedBinding
- mkPi :: ExprInfo -> Telescope -> Expr -> Expr
- 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])
- module Agda.Syntax.Abstract.Name
Documentation
class SubstExpr a where Source #
Nothing
Instances
SubstExpr Name Source # | |
SubstExpr ModuleName Source # | |
Defined in Agda.Syntax.Abstract substExpr :: [(Name, Expr)] -> ModuleName -> ModuleName Source # | |
SubstExpr Expr Source # | |
SubstExpr a => SubstExpr [a] Source # | |
SubstExpr a => SubstExpr (Maybe a) Source # | |
SubstExpr a => SubstExpr (List1 a) 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 b) => SubstExpr (Either a b) Source # | |
(SubstExpr a, SubstExpr b) => SubstExpr (a, b) Source # | |
SubstExpr a => SubstExpr (Named name a) Source # | |
type PatternSynDefns = Map QName PatternSynDefn Source #
class NameToExpr a where Source #
Turn a name into an expression.
nameToExpr :: a -> Expr Source #
Instances
NameToExpr ResolvedName Source # | Turn a Assumes name is not |
Defined in Agda.Syntax.Abstract nameToExpr :: ResolvedName -> Expr Source # | |
NameToExpr AbstractName Source # | Turn an |
Defined in Agda.Syntax.Abstract nameToExpr :: AbstractName -> 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 TacticAttr (List1 (NamedArg Binder)) Expr | As in telescope |
TLet Range (List1 LetBinding) | E.g. |
Instances
data LamBinding Source #
A lambda binding is either domain free or typed.
DomainFree TacticAttr (NamedArg Binder) | . |
DomainFull TypedBinding | . |
Instances
Binder | |
|
Instances
Functor Binder' Source # | |
Foldable Binder' Source # | |
Defined in Agda.Syntax.Abstract fold :: Monoid m => Binder' m -> m # foldMap :: Monoid m => (a -> m) -> Binder' a -> m # foldMap' :: Monoid m => (a -> m) -> Binder' a -> m # foldr :: (a -> b -> b) -> b -> Binder' a -> b # foldr' :: (a -> b -> b) -> b -> Binder' a -> b # foldl :: (b -> a -> b) -> b -> Binder' a -> b # foldl' :: (b -> a -> b) -> b -> Binder' a -> b # foldr1 :: (a -> a -> a) -> Binder' a -> a # foldl1 :: (a -> a -> a) -> Binder' a -> a # elem :: Eq a => a -> Binder' a -> Bool # maximum :: Ord a => Binder' a -> a # minimum :: Ord a => Binder' a -> a # | |
Traversable Binder' Source # | |
Eq a => Eq (Binder' a) Source # | |
Data a => Data (Binder' a) Source # | |
Defined in Agda.Syntax.Abstract gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Binder' a -> c (Binder' a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Binder' a) # toConstr :: Binder' a -> Constr # dataTypeOf :: Binder' a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Binder' a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Binder' a)) # gmapT :: (forall b. Data b => b -> b) -> Binder' a -> Binder' a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Binder' a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Binder' a -> r # gmapQ :: (forall d. Data d => d -> u) -> Binder' a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Binder' a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Binder' a -> m (Binder' a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Binder' a -> m (Binder' a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Binder' a -> m (Binder' a) # | |
Show a => Show (Binder' a) Source # | |
Generic (Binder' a) Source # | |
NFData a => NFData (Binder' a) Source # | |
Defined in Agda.Syntax.Abstract | |
KillRange a => KillRange (Binder' a) Source # | |
Defined in Agda.Syntax.Abstract killRange :: KillRangeT (Binder' a) Source # | |
HasRange a => HasRange (Binder' a) Source # | |
ToConcrete a => ToConcrete (Binder' a) Source # | |
type Rep (Binder' a) Source # | |
Defined in Agda.Syntax.Abstract type Rep (Binder' a) = D1 ('MetaData "Binder'" "Agda.Syntax.Abstract" "Agda-2.6.2.2-DXbLWdCWC6QEApzM0094If" 'False) (C1 ('MetaCons "Binder" 'PrefixI 'True) (S1 ('MetaSel ('Just "binderPattern") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Pattern)) :*: S1 ('MetaSel ('Just "binderName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) | |
type ConOfAbs (Binder' a) Source # | |
Defined in Agda.Syntax.Translation.AbstractToConcrete |
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 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 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 | |
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 #
Axiom KindOfName 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. |
Generalize (Set QName) DefInfo ArgInfo QName Expr | First argument is set of generalizable variables used in the type. |
Field DefInfo QName (Arg Expr) | record field |
Primitive DefInfo QName (Arg Expr) | primitive function |
Mutual MutualInfo [Declaration] | a bunch of mutually recursive definitions |
Section Range ModuleName GeneralizeTelescope [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 GeneralizeTelescope Expr | lone data signature |
DataDef DefInfo QName UniverseCheck DataDefParams [Constructor] | |
RecSig DefInfo QName GeneralizeTelescope Expr | lone record signature |
RecDef DefInfo QName UniverseCheck RecordDirectives DataDefParams Expr [Declaration] | The |
PatternSynDef QName [Arg BindName] (Pattern' Void) | Only for highlighting purposes |
UnquoteDecl MutualInfo [DefInfo] [QName] Expr | |
UnquoteDef [DefInfo] [QName] Expr | |
ScopedDecl ScopeInfo [Declaration] | scope annotation |
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 Expr | Dependent function space |
Generalized (Set QName) Expr | Like a Pi, but the ordering is not known |
Fun ExprInfo (Arg Expr) Expr | Non-dependent function space. |
Let ExprInfo (List1 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. |
Quote ExprInfo | Quote an identifier |
QuoteTerm ExprInfo | Quote a term. |
Unquote ExprInfo | The splicing construct: unquote ... |
DontCare Expr | For printing |
Instances
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 #
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 #
module Agda.Syntax.Abstract.Name