Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
This module contains the definition of expressions for function declarations and type signatures for our intermediate language.
Synopsis
- data TypeSig = TypeSig {}
- data FuncDecl = FuncDecl {}
- funcDeclQName :: FuncDecl -> QName
- funcDeclName :: FuncDecl -> Name
- funcDeclType :: FuncDecl -> Maybe Type
- funcDeclTypeScheme :: FuncDecl -> Maybe TypeScheme
Documentation
A type signature of one or more function declarations.
Instances
Eq TypeSig Source # | |
Show TypeSig Source # | |
Pretty TypeSig Source # | Pretty instance for type signatures. |
Defined in FreeC.IR.Syntax.FuncDecl | |
Similar TypeSig Source # | Two type signatures are similar if they annotate the type of the same functions with similar types. Γ ⊢ τ ≈ τ' ———————————————————————————————————————— Γ ⊢ f₁, … , fₙ :: τ ≈ f₁, … , fₙ :: τ' |
Defined in FreeC.IR.Similar | |
Parseable TypeSig Source # | |
Defined in FreeC.Frontend.IR.Parser |
A function declaration.
FuncDecl | |
|
Instances
Eq FuncDecl Source # | |
Show FuncDecl Source # | |
Pretty FuncDecl Source # | Pretty instance for function declarations. |
Defined in FreeC.IR.Syntax.FuncDecl | |
HasDeclIdent FuncDecl Source # | Instance to get the name of a function declaration. |
StripExprType FuncDecl Source # | Strips the expression type annotations from function declarations. |
Defined in FreeC.IR.Strip stripExprType :: FuncDecl -> FuncDecl Source # | |
Similar FuncDecl Source # | Two function declarations are similar if their right-hand sides are
similar under an extended Γ ∪ { α₁ ↦ β₁, …, αₘ ↦ βₘ, x₁ ↦ y₁, …, xₙ ↦ yₙ } ⊢ e ≈ f Γ ∪ { α₁ ↦ β₁, …, αₘ ↦ βₘ } ⊢ p₁ ≈ q₁, …, Γ ∪ { α₁ ↦ β₁, …, αₘ ↦ βₘ } ⊢ pₙ ≈ qₙ —————————————————————————————————————————————————————————— Γ ⊢ g @α₁ … @αₘ p₁ … pₙ = e ≈ g @β₁ … @βₘ q₁ … qₙ = f where 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 |
Defined in FreeC.IR.Similar | |
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. |
Defined in FreeC.IR.Reference | |
Parseable FuncDecl Source # | Function declarations can be parsed. |
Defined in FreeC.Frontend.IR.Parser | |
ApplySubst Type FuncDecl Source # | Applies the given type substitution to the right-hand side of a function declaration. |
Defined in FreeC.IR.Subst | |
ApplySubst Expr FuncDecl Source # | Applies the given expression substitution to the right-hand side of a function declaration. |
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.