free-compiler-0.3.0.0: A Haskell to Coq compiler.

Safe HaskellNone
LanguageHaskell2010

FreeC.Backend.Agda.Syntax

Contents

Description

This module exports the original Agda AST to reduce coupling with the Agda libraries.

Synopsis

Identifiers

name :: String -> Name Source #

Creates a (not qualified) Agda variable name from a String.

qname :: [Name] -> Name -> QName Source #

Create a qualified identifier given a local identifier as Name and a list of module Names.

qname' :: Name -> QName Source #

Creates a qualified name using an empty list of module names.

Imports

simpleImport :: QName -> Declaration Source #

Creates an open import declaration for the given qualified name.

open import [modName]

Declarations

moduleDecl :: QName -> [Declaration] -> Declaration Source #

Smart constructor for creating a module containing a list of declarations.

funcSig :: Name -> Expr -> Declaration Source #

Smart constructor for creating function type declarations.

funcSig foo expr = foo : expr

patternSyn :: Name -> [Arg Name] -> Pattern -> Declaration Source #

Smart constructor for pattern synonyms.

pattern C x₁ … xₙ = pure (c x₁ … xₙ)

funcDef :: QName -> [QName] -> Expr -> Declaration Source #

Smart constructor for function definitions.

f a₁ … aₙ = expr

Pattern

appP :: Pattern -> Pattern -> Pattern Source #

Creates an application AST node in a pattern context.

Application is left associative. Parenthesis are added automatically if the right child is also an AppP node.

e a

Expressions

intLiteral :: Integer -> Expr Source #

Creates an integer literal.

stringLiteral :: String -> Expr Source #

Creates a string literal.

lambda :: [Name] -> Expr -> Expr Source #

Creates a lambda expression, binding the given names and abstracting the given expression.

λ x y … → [expr]

app :: Expr -> Expr -> Expr Source #

Creates an application AST node.

Application is left associative and in type expressions binds stronger than type arrow. For these cases paren- thesis are added automatically.

e a

appN :: Expr -> [Expr] -> Expr Source #

Applies the list of arguments to the given expression. If the expression is an operator the application is written in mixfix notation.

ident :: String -> Expr Source #

Helper function for creating expressions from Strings.

hiddenArg_ :: Expr -> Expr Source #

Hides the given expression.

e ↦ {e}

ifThenElse :: Expr -> Expr -> Expr -> Expr Source #

if_then_else_ from the base library.

cond true false ↦ if cond then true else false

caseOf :: Expr -> [LamClause] -> Expr Source #

case_of_ from the base library.

disrc clauses ↦ case disrc of λ { clause₁ ; clause₂ ; … }

lamClause :: Pattern -> Expr -> LamClause Source #

Smart constructor for a clause of a pattern matching lambda abstraction.

Each LamClause stores a pattern matched on the left-hand side of an and the expression on the right-hand side. In Agda lambda expressions can pattern match on their arguments.

Types

set :: Expr Source #

The first level of Agda's hierarchy of type theoretic universes.

dataDecl :: Name -> [LamBinding] -> Expr -> [Declaration] -> Declaration Source #

Creates a data declaration with the given name, binding the list of type variables and defining the list of constructors.

D [b₁, …, bₙ] [C₁, …, Cₘ]
  ↧
data D b₁ … bₙ : Set where
  C₁
  ⋮
  Cₘ

binding :: [Name] -> Expr -> LamBinding Source #

Creates a binder with visible args.

[α₁, …, αₙ] e ↦ (α₁ … αₙ : e)

fun :: Expr -> Expr -> Expr Source #

A smart constructor for non dependent function types.

pi :: [Name] -> Expr -> Expr Source #

Creates a pi type binding the given names as hidden variables.

pi [α₁, …, αₙ] expr ↦ ∀ {α₁} … {αₙ} → expr