Agda-2.2.6: A dependently typed functional programming language and proof assistant

Agda.Syntax.Concrete

Contents

Description

The concrete syntax is a raw representation of the program text without any desugaring at all. This is what the parser produces. The idea is that if we figure out how to keep the concrete syntax around, it can be printed exactly as the user wrote it.

Synopsis

Expressions

data Expr Source

Concrete expressions. Should represent exactly what the user wrote.

Constructors

Ident QName

ex: x

Lit Literal

ex: 1 or "foo"

QuestionMark !Range (Maybe Nat)

ex: ? or {! ... !}

Underscore !Range (Maybe Nat)

ex: _

RawApp !Range [Expr]

before parsing operators

App !Range Expr (NamedArg Expr)

ex: e e, e {e}, or e {x = e}

OpApp !Range Name [Expr]

ex: e + e

WithApp !Range Expr [Expr]

ex: e | e1 | .. | en

HiddenArg !Range (Named String Expr)

ex: {e} or {x=e}

Lam !Range [LamBinding] Expr

ex: \x {y} -> e or \(x:A){y:B} -> e

AbsurdLam !Range Hiding

ex: \ ()

Fun !Range Expr Expr

ex: e -> e or {e} -> e

Pi Telescope Expr

ex: (xs:e) -> e or {xs:e} -> e

Set !Range

ex: Set

Prop !Range

ex: Prop

SetN !Range Nat

ex: Set0, Set1, ..

Rec !Range [(Name, Expr)]

ex: record {x = a; y = b}

Let !Range [Declaration] Expr

ex: let Ds in e

Paren !Range Expr

ex: (e)

Absurd !Range

ex: () or {}, only in patterns

As !Range Name Expr

ex: x@p, only in patterns

Dot !Range Expr

ex: .p, only in patterns

ETel Telescope

only used for printing telescopes

data AppView Source

The Expr is not an application.

Constructors

AppView Expr [NamedArg Expr] 

Bindings

data TypedBindings Source

A sequence of typed bindings with hiding information. Appears in dependent function spaces, typed lambdas, and telescopes.

Constructors

TypedBindings !Range Hiding [TypedBinding]

. (xs:e;..;ys:e') or {xs:e;..;ys:e'}

type Telescope = [TypedBindings]Source

A telescope is a sequence of typed bindings. Bound variables are in scope in later types. Or it's the mysterious Thierry-function-telescope. Only it's not.

Declarations

type TypeSignature = DeclarationSource

Just type signatures.

type Constructor = TypeSignatureSource

A constructor or field declaration is just a type signature.

data ImportDirective Source

The things you are allowed to say when you shuffle names between name spaces (i.e. in import, namespace, or open declarations).

Constructors

ImportDirective 

Fields

importDirRange :: !Range
 
usingOrHiding :: UsingOrHiding
 
renaming :: [Renaming]
 
publicOpen :: Bool

Only for open. Exports the opened names from the current module.

data Renaming Source

Constructors

Renaming 

Fields

renFrom :: ImportedName

Rename from this name.

renTo :: Name

To this one.

renToRange :: Range

The range of the "to" keyword. Retained for highlighting purposes.

data AsName Source

Constructors

AsName 

Fields

asName :: Name

The "as" name.

asRange :: Range

The range of the "as" keyword. Retained for highlighting purposes.

data LHS Source

Left hand sides can be written in infix style. For example:

 n + suc m = suc (n + m)
 (f  g) x = f (g x)

We use fixity information to see which name is actually defined.

Constructors

LHS Pattern [Pattern] [RewriteEqn] [WithExpr]

original pattern, with-patterns, rewrite equations and with-expressions

Ellipsis Range [Pattern] [RewriteEqn] [WithExpr]

new with-patterns, rewrite equations and with-expressions

type Module = ([Pragma], [Declaration])Source

Modules: Top-level pragmas plus other top-level declarations.

topLevelModuleName :: Module -> TopLevelModuleNameSource

Computes the top-level module name.

Precondition: The Module has to be well-formed.