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

Safe HaskellSafe
LanguageHaskell2010

FreeC.IR.Syntax.FuncDecl

Description

This module contains the definition of expressions for function declarations and type signatures for our intermediate language.

Synopsis

Documentation

data TypeSig Source #

A type signature of one or more function declarations.

Instances
Eq TypeSig Source # 
Instance details

Defined in FreeC.IR.Syntax.FuncDecl

Show TypeSig Source # 
Instance details

Defined in FreeC.IR.Syntax.FuncDecl

Pretty TypeSig Source #

Pretty instance for type signatures.

Instance details

Defined in FreeC.IR.Syntax.FuncDecl

Methods

pretty :: TypeSig -> Doc #

prettyList :: [TypeSig] -> Doc #

Similar TypeSig Source #

Two type signatures are similar if they annotate the type of the same functions with similar types.

 Γ ⊢ τ ≈ τ'
————————————————————————————————————————
 Γ ⊢ f₁, … , fₙ :: τ ≈ f₁, … , fₙ :: τ'
Instance details

Defined in FreeC.IR.Similar

Methods

similar' :: TypeSig -> TypeSig -> Renaming -> Bool

Parseable TypeSig Source # 
Instance details

Defined in FreeC.Frontend.IR.Parser

Methods

parseIR' :: Parser TypeSig Source #

data FuncDecl Source #

A function declaration.

Constructors

FuncDecl 

Fields

Instances
Eq FuncDecl Source # 
Instance details

Defined in FreeC.IR.Syntax.FuncDecl

Show FuncDecl Source # 
Instance details

Defined in FreeC.IR.Syntax.FuncDecl

Pretty FuncDecl Source #

Pretty instance for function declarations.

Instance details

Defined in FreeC.IR.Syntax.FuncDecl

Methods

pretty :: FuncDecl -> Doc #

prettyList :: [FuncDecl] -> Doc #

HasDeclIdent FuncDecl Source #

Instance to get the name of a function declaration.

Instance details

Defined in FreeC.IR.Syntax.FuncDecl

StripExprType FuncDecl Source #

Strips the expression type annotations from function declarations.

Instance details

Defined in FreeC.IR.Strip

Similar FuncDecl Source #

Two function declarations are similar if their right-hand sides are similar under an extended Renaming that maps the corresponding type arguments and arguments to each other. If the arguments are annotated, their type annotations must be similar under an extended Renaming that maps the corresponding type arguments to each other.

 Γ ∪ { α₁ ↦ β₁, …, αₘ ↦ βₘ, x₁ ↦ y₁, …, xₙ ↦ yₙ } ⊢ e ≈ f
 Γ ∪ { α₁ ↦ β₁, …, αₘ ↦ βₘ } ⊢ p₁ ≈ q₁, …,
 Γ ∪ { α₁ ↦ β₁, …, αₘ ↦ βₘ } ⊢ pₙ ≈ qₙ
——————————————————————————————————————————————————————————
 Γ ⊢ g @α₁ … @αₘ p₁ … pₙ = e ≈ g @β₁ … @βₘ q₁ … qₙ = f

where xᵢ and yᵢ denote the names of the variables bound by the patterns pᵢ and qᵢ respectively.

If the function has an explicit return type annotation, the annotated return typed must be similar as well.

 Γ ∪ { α₁ ↦ β₁, …, αₘ ↦ βₘ, x₁ ↦ y₁, …, xₙ ↦ yₙ } ⊢ e ≈ f
 Γ ∪ { α₁ ↦ β₁, …, αₘ ↦ βₘ } ⊢ p₁ ≈ q₁, …,
 Γ ∪ { α₁ ↦ β₁, …, αₘ ↦ βₘ } ⊢ pₙ ≈ qₙ,
 Γ ∪ { α₁ ↦ β₁, …, αₘ ↦ βₘ } ⊢ τ ≈ τ',
——————————————————————————————————————————————————————————
 Γ ⊢ g @α₁ … @αₘ p₁ … pₙ :: τ = e ≈ g @β₁ … @βₘ q₁ … qₙ :: τ' = f
Instance details

Defined in FreeC.IR.Similar

Methods

similar' :: FuncDecl -> FuncDecl -> Renaming -> Bool

HasRefs FuncDecl Source #

Function declarations refer to the types their argument and return type annotations refer to as well as the references of their right-hand side except for the (type) variables bound by the function's (type) arguments.

Instance details

Defined in FreeC.IR.Reference

Methods

refSet :: FuncDecl -> RefSet

Parseable FuncDecl Source #

Function declarations can be parsed.

Instance details

Defined in FreeC.Frontend.IR.Parser

Methods

parseIR' :: Parser FuncDecl Source #

ApplySubst Type FuncDecl Source #

Applies the given type substitution to the right-hand side of a function declaration.

Instance details

Defined in FreeC.IR.Subst

ApplySubst Expr FuncDecl Source #

Applies the given expression substitution to the right-hand side of a function declaration.

Instance details

Defined in FreeC.IR.Subst

funcDeclQName :: FuncDecl -> QName Source #

Gets the qualified name of the given function declaration.

funcDeclName :: FuncDecl -> Name Source #

Gets the unqualified name of the given function declaration.

funcDeclType :: FuncDecl -> Maybe Type Source #

Gets the type of the given function declaration or Nothing if at least one of the argument or return type is not annotated.

In contrast to funcDeclTypeScheme the function's type arguments are not abstracted away.

funcDeclTypeScheme :: FuncDecl -> Maybe TypeScheme Source #

Gets the type scheme of the given function declaration or Nothing if at least one of the argument or the return type is not annotated.