Documentation
¶
Index ¶
- Constants
- type AlgebraicAlternative
- func (a AlgebraicAlternative) Constructor() Constructor
- func (a AlgebraicAlternative) ConvertTypes(f func(types.Type) types.Type) AlgebraicAlternative
- func (a AlgebraicAlternative) ElementNames() []string
- func (a AlgebraicAlternative) Expression() Expression
- func (a AlgebraicAlternative) RenameVariables(vs map[string]string) AlgebraicAlternative
- func (a AlgebraicAlternative) VisitExpressions(f func(Expression) error) error
- type AlgebraicCase
- func (c AlgebraicCase) Alternatives() []AlgebraicAlternative
- func (c AlgebraicCase) Argument() Expression
- func (c AlgebraicCase) ConvertTypes(f func(types.Type) types.Type) Expression
- func (c AlgebraicCase) DefaultAlternative() (DefaultAlternative, bool)
- func (c AlgebraicCase) RenameVariables(vs map[string]string) Expression
- func (c AlgebraicCase) VisitExpressions(f func(Expression) error) error
- type Argument
- type Atom
- type Bind
- type Case
- type Constructor
- type ConstructorApplication
- func (a ConstructorApplication) Arguments() []Atom
- func (a ConstructorApplication) Constructor() Constructor
- func (a ConstructorApplication) ConvertTypes(func(types.Type) types.Type) Expression
- func (a ConstructorApplication) RenameVariables(vs map[string]string) Expression
- func (a ConstructorApplication) VisitExpressions(f func(Expression) error) error
- type Declaration
- type DefaultAlternative
- func (a DefaultAlternative) ConvertTypes(f func(types.Type) types.Type) DefaultAlternative
- func (a DefaultAlternative) Expression() Expression
- func (a DefaultAlternative) RenameVariables(vs map[string]string) DefaultAlternative
- func (a DefaultAlternative) Variable() string
- func (a DefaultAlternative) VisitExpressions(f func(Expression) error) error
- type Expression
- type Float64
- type FunctionApplication
- func (a FunctionApplication) Arguments() []Atom
- func (a FunctionApplication) ConvertTypes(func(types.Type) types.Type) Expression
- func (a FunctionApplication) Function() Variable
- func (a FunctionApplication) RenameVariables(vs map[string]string) Expression
- func (a FunctionApplication) VisitExpressions(f func(Expression) error) error
- type Lambda
- func (l Lambda) ArgumentNames() []string
- func (l Lambda) Body() Expression
- func (l Lambda) ClearFreeVariables() Lambda
- func (l Lambda) ConvertTypes(f func(types.Type) types.Type) Lambda
- func (l Lambda) FreeVariableNames() []string
- func (l Lambda) RenameVariables(vs map[string]string) Lambda
- func (l Lambda) ToDeclaration() LambdaDeclaration
- func (l Lambda) VisitExpressions(f func(Expression) error) error
- type LambdaDeclaration
- func (l LambdaDeclaration) ArgumentTypes() []types.Type
- func (l LambdaDeclaration) ConvertTypes(f func(types.Type) types.Type) LambdaDeclaration
- func (l LambdaDeclaration) FreeVariableTypes() []types.Type
- func (l LambdaDeclaration) IsThunk() bool
- func (l LambdaDeclaration) ResultType() types.Type
- func (l LambdaDeclaration) Type() types.Type
- type Let
- type Literal
- type Module
- func (m Module) Binds() []Bind
- func (m Module) ConvertTypes(f func(types.Type) types.Type) Module
- func (m Module) Declarations() []Declaration
- func (m Module) RenameVariables(vs map[string]string) Module
- func (m Module) Types() []types.Type
- func (m Module) VisitExpressions(f func(Expression) error) error
- type PrimitiveAlternative
- func (a PrimitiveAlternative) ConvertTypes(f func(types.Type) types.Type) PrimitiveAlternative
- func (a PrimitiveAlternative) Expression() Expression
- func (a PrimitiveAlternative) Literal() Literal
- func (a PrimitiveAlternative) RenameVariables(vs map[string]string) PrimitiveAlternative
- func (a PrimitiveAlternative) VisitExpressions(f func(Expression) error) error
- type PrimitiveCase
- func (c PrimitiveCase) Alternatives() []PrimitiveAlternative
- func (c PrimitiveCase) Argument() Expression
- func (c PrimitiveCase) ConvertTypes(f func(types.Type) types.Type) Expression
- func (c PrimitiveCase) DefaultAlternative() (DefaultAlternative, bool)
- func (c PrimitiveCase) RenameVariables(vs map[string]string) Expression
- func (c PrimitiveCase) Type() types.Primitive
- func (c PrimitiveCase) VisitExpressions(f func(Expression) error) error
- type PrimitiveOperation
- func (o PrimitiveOperation) Arguments() []Atom
- func (o PrimitiveOperation) ConvertTypes(func(types.Type) types.Type) Expression
- func (o PrimitiveOperation) PrimitiveOperator() PrimitiveOperator
- func (o PrimitiveOperation) RenameVariables(vs map[string]string) Expression
- func (o PrimitiveOperation) VisitExpressions(f func(Expression) error) error
- type PrimitiveOperator
- type Variable
Constants ¶
const ( // AddFloat64 is a primitive operator. AddFloat64 PrimitiveOperator = "+" // SubtractFloat64 is a primitive operator. SubtractFloat64 = "-" // MultiplyFloat64 is a primitive operator. MultiplyFloat64 = "*" // DivideFloat64 is a primitive operator. DivideFloat64 = "/" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlgebraicAlternative ¶
type AlgebraicAlternative struct {
// contains filtered or unexported fields
}
AlgebraicAlternative is an algebraic alternative.
func NewAlgebraicAlternative ¶
func NewAlgebraicAlternative(c Constructor, es []string, e Expression) AlgebraicAlternative
NewAlgebraicAlternative creates an algebraic alternative.
func (AlgebraicAlternative) Constructor ¶
func (a AlgebraicAlternative) Constructor() Constructor
Constructor returns a constructor.
func (AlgebraicAlternative) ConvertTypes ¶
func (a AlgebraicAlternative) ConvertTypes(f func(types.Type) types.Type) AlgebraicAlternative
ConvertTypes converts types.
func (AlgebraicAlternative) ElementNames ¶
func (a AlgebraicAlternative) ElementNames() []string
ElementNames returns element names.
func (AlgebraicAlternative) Expression ¶
func (a AlgebraicAlternative) Expression() Expression
Expression is an expression.
func (AlgebraicAlternative) RenameVariables ¶
func (a AlgebraicAlternative) RenameVariables(vs map[string]string) AlgebraicAlternative
RenameVariables renames variables.
func (AlgebraicAlternative) VisitExpressions ¶
func (a AlgebraicAlternative) VisitExpressions(f func(Expression) error) error
VisitExpressions visits expressions.
type AlgebraicCase ¶
type AlgebraicCase struct {
// contains filtered or unexported fields
}
AlgebraicCase is an algebraic case expression.
func NewAlgebraicCase ¶
func NewAlgebraicCase(e Expression, as []AlgebraicAlternative, a DefaultAlternative) AlgebraicCase
NewAlgebraicCase creates an algebraic case expression.
func NewAlgebraicCaseWithoutDefault ¶
func NewAlgebraicCaseWithoutDefault(e Expression, as []AlgebraicAlternative) AlgebraicCase
NewAlgebraicCaseWithoutDefault creates an algebraic case expression.
func (AlgebraicCase) Alternatives ¶
func (c AlgebraicCase) Alternatives() []AlgebraicAlternative
Alternatives returns alternatives.
func (AlgebraicCase) Argument ¶
func (c AlgebraicCase) Argument() Expression
func (AlgebraicCase) ConvertTypes ¶
func (c AlgebraicCase) ConvertTypes(f func(types.Type) types.Type) Expression
ConvertTypes converts types.
func (AlgebraicCase) DefaultAlternative ¶
func (c AlgebraicCase) DefaultAlternative() (DefaultAlternative, bool)
func (AlgebraicCase) RenameVariables ¶
func (c AlgebraicCase) RenameVariables(vs map[string]string) Expression
RenameVariables renames variables.
func (AlgebraicCase) VisitExpressions ¶
func (c AlgebraicCase) VisitExpressions(f func(Expression) error) error
VisitExpressions visits expressions.
type Argument ¶
type Argument struct {
// contains filtered or unexported fields
}
Argument is a argument.
func NewArgument ¶
NewArgument creates an argument.
func (Argument) ConvertTypes ¶
ConvertTypes converts types.
func (Argument) RenameVariables ¶
RenameVariables renames variables.
type Atom ¶
type Atom interface { RenameVariablesInAtom(map[string]string) Atom // contains filtered or unexported methods }
Atom is an atom.
type Bind ¶
type Bind struct {
// contains filtered or unexported fields
}
Bind is a bind statement.
func (Bind) ConvertTypes ¶
ConvertTypes converts types.
func (Bind) RenameVariables ¶
RenameVariables renames variables.
func (Bind) VisitExpressions ¶
func (b Bind) VisitExpressions(f func(Expression) error) error
VisitExpressions visits expressions.
type Case ¶
type Case interface { Expression Argument() Expression DefaultAlternative() (DefaultAlternative, bool) }
Case is a case expression.
type Constructor ¶
type Constructor struct {
// contains filtered or unexported fields
}
Constructor is a constructor.
func NewConstructor ¶
func NewConstructor(t types.Algebraic, i int) Constructor
NewConstructor creates a constructor.
func (Constructor) AlgebraicType ¶
func (c Constructor) AlgebraicType() types.Algebraic
AlgebraicType returns an algebraic type.
func (Constructor) ConstructorType ¶
func (c Constructor) ConstructorType() types.Constructor
ConstructorType returns a constructor type.
type ConstructorApplication ¶
type ConstructorApplication struct {
// contains filtered or unexported fields
}
ConstructorApplication is a constructor application.
func NewConstructorApplication ¶
func NewConstructorApplication(c Constructor, as []Atom) ConstructorApplication
NewConstructorApplication creates a constructor application.
func (ConstructorApplication) Arguments ¶
func (a ConstructorApplication) Arguments() []Atom
Arguments returns arguments.
func (ConstructorApplication) Constructor ¶
func (a ConstructorApplication) Constructor() Constructor
Constructor returns a constructor.
func (ConstructorApplication) ConvertTypes ¶
func (a ConstructorApplication) ConvertTypes(func(types.Type) types.Type) Expression
ConvertTypes converts types.
func (ConstructorApplication) RenameVariables ¶
func (a ConstructorApplication) RenameVariables(vs map[string]string) Expression
RenameVariables renames variables.
func (ConstructorApplication) VisitExpressions ¶
func (a ConstructorApplication) VisitExpressions(f func(Expression) error) error
VisitExpressions visits expressions.
type Declaration ¶
type Declaration struct {
// contains filtered or unexported fields
}
Declaration is a declaration.
func NewDeclaration ¶
func NewDeclaration(n string, l LambdaDeclaration) Declaration
NewDeclaration creates a declaration.
func (Declaration) ConvertTypes ¶
func (d Declaration) ConvertTypes(f func(types.Type) types.Type) Declaration
ConvertTypes converts types.
func (Declaration) Lambda ¶
func (d Declaration) Lambda() LambdaDeclaration
Lambda returns a lambda declaration.
type DefaultAlternative ¶
type DefaultAlternative struct {
// contains filtered or unexported fields
}
DefaultAlternative is a default alternative.
func NewDefaultAlternative ¶
func NewDefaultAlternative(s string, e Expression) DefaultAlternative
NewDefaultAlternative creates a default alternative.
func (DefaultAlternative) ConvertTypes ¶
func (a DefaultAlternative) ConvertTypes(f func(types.Type) types.Type) DefaultAlternative
ConvertTypes converts types.
func (DefaultAlternative) Expression ¶
func (a DefaultAlternative) Expression() Expression
Expression is an expression.
func (DefaultAlternative) RenameVariables ¶
func (a DefaultAlternative) RenameVariables(vs map[string]string) DefaultAlternative
RenameVariables renames variables.
func (DefaultAlternative) Variable ¶
func (a DefaultAlternative) Variable() string
Variable returns a bound variable.
func (DefaultAlternative) VisitExpressions ¶
func (a DefaultAlternative) VisitExpressions(f func(Expression) error) error
VisitExpressions visits expressions.
type Expression ¶
type Expression interface { VisitExpressions(func(Expression) error) error ConvertTypes(func(types.Type) types.Type) Expression RenameVariables(map[string]string) Expression // contains filtered or unexported methods }
Expression is an expression.
type Float64 ¶
type Float64 struct {
// contains filtered or unexported fields
}
Float64 is a float64 literal.
func (Float64) ConvertTypes ¶
ConvertTypes converts types.
func (Float64) RenameVariables ¶
func (f Float64) RenameVariables(map[string]string) Expression
RenameVariables renames variables.
func (Float64) RenameVariablesInAtom ¶
RenameVariablesInAtom renames variables.
func (Float64) VisitExpressions ¶
func (f Float64) VisitExpressions(ff func(Expression) error) error
VisitExpressions visits expressions.
type FunctionApplication ¶
type FunctionApplication struct {
// contains filtered or unexported fields
}
FunctionApplication is a function application.
func NewFunctionApplication ¶
func NewFunctionApplication(v Variable, as []Atom) FunctionApplication
NewFunctionApplication creates an application.
func (FunctionApplication) Arguments ¶
func (a FunctionApplication) Arguments() []Atom
Arguments returns arguments.
func (FunctionApplication) ConvertTypes ¶
func (a FunctionApplication) ConvertTypes(func(types.Type) types.Type) Expression
ConvertTypes converts types.
func (FunctionApplication) Function ¶
func (a FunctionApplication) Function() Variable
Function returns a function.
func (FunctionApplication) RenameVariables ¶
func (a FunctionApplication) RenameVariables(vs map[string]string) Expression
RenameVariables renames variables.
func (FunctionApplication) VisitExpressions ¶
func (a FunctionApplication) VisitExpressions(f func(Expression) error) error
VisitExpressions visits expressions.
type Lambda ¶
type Lambda struct { LambdaDeclaration // contains filtered or unexported fields }
Lambda is a lambda form.
func NewFunctionLambda ¶
NewFunctionLambda creates a lambda form.
func NewVariableLambda ¶
func NewVariableLambda(vs []Argument, e Expression, t types.Bindable) Lambda
NewVariableLambda creates a lambda form.
func (Lambda) ArgumentNames ¶
ArgumentNames returns argument names.
func (Lambda) ClearFreeVariables ¶
ClearFreeVariables clears free variables.
func (Lambda) ConvertTypes ¶
ConvertTypes converts types.
func (Lambda) FreeVariableNames ¶
FreeVariableNames returns free varriable names.
func (Lambda) RenameVariables ¶
RenameVariables renames variables.
func (Lambda) ToDeclaration ¶
func (l Lambda) ToDeclaration() LambdaDeclaration
ToDeclaration returns a lambda declaration.
func (Lambda) VisitExpressions ¶
func (l Lambda) VisitExpressions(f func(Expression) error) error
VisitExpressions visits expressions.
type LambdaDeclaration ¶
type LambdaDeclaration struct {
// contains filtered or unexported fields
}
LambdaDeclaration is a declaration.
func NewLambdaDeclaration ¶
NewLambdaDeclaration creates a declaration.
func (LambdaDeclaration) ArgumentTypes ¶
func (l LambdaDeclaration) ArgumentTypes() []types.Type
ArgumentTypes returns argument types.
func (LambdaDeclaration) ConvertTypes ¶
func (l LambdaDeclaration) ConvertTypes(f func(types.Type) types.Type) LambdaDeclaration
ConvertTypes converts types.
func (LambdaDeclaration) FreeVariableTypes ¶
func (l LambdaDeclaration) FreeVariableTypes() []types.Type
FreeVariableTypes returns free variable types.
func (LambdaDeclaration) IsThunk ¶
func (l LambdaDeclaration) IsThunk() bool
IsThunk returns true if the lambda form is a thunk, or false otherwise.
func (LambdaDeclaration) ResultType ¶
func (l LambdaDeclaration) ResultType() types.Type
ResultType returns a result type.
type Let ¶
type Let struct {
// contains filtered or unexported fields
}
Let is a let expression.
func (Let) ConvertTypes ¶
ConvertTypes converts types.
func (Let) RenameVariables ¶
func (l Let) RenameVariables(vs map[string]string) Expression
RenameVariables renames variables.
func (Let) VisitExpressions ¶
func (l Let) VisitExpressions(f func(Expression) error) error
VisitExpressions visits expressions.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module is a module.
func (Module) ConvertTypes ¶
ConvertTypes converts types.
func (Module) Declarations ¶
func (m Module) Declarations() []Declaration
Declarations returns declarations.
func (Module) RenameVariables ¶
RenameVariables renames variables.
func (Module) VisitExpressions ¶
func (m Module) VisitExpressions(f func(Expression) error) error
VisitExpressions visits expressions.
type PrimitiveAlternative ¶
type PrimitiveAlternative struct {
// contains filtered or unexported fields
}
PrimitiveAlternative is a primitive alternative.
func NewPrimitiveAlternative ¶
func NewPrimitiveAlternative(l Literal, e Expression) PrimitiveAlternative
NewPrimitiveAlternative creates a primitive alternative.
func (PrimitiveAlternative) ConvertTypes ¶
func (a PrimitiveAlternative) ConvertTypes(f func(types.Type) types.Type) PrimitiveAlternative
ConvertTypes converts types.
func (PrimitiveAlternative) Expression ¶
func (a PrimitiveAlternative) Expression() Expression
Expression is an expression.
func (PrimitiveAlternative) Literal ¶
func (a PrimitiveAlternative) Literal() Literal
Literal returns a literal pattern.
func (PrimitiveAlternative) RenameVariables ¶
func (a PrimitiveAlternative) RenameVariables(vs map[string]string) PrimitiveAlternative
RenameVariables renames variables.
func (PrimitiveAlternative) VisitExpressions ¶
func (a PrimitiveAlternative) VisitExpressions(f func(Expression) error) error
VisitExpressions visits expressions.
type PrimitiveCase ¶
type PrimitiveCase struct {
// contains filtered or unexported fields
}
PrimitiveCase is a primitive case expression.
func NewPrimitiveCase ¶
func NewPrimitiveCase(e Expression, t types.Primitive, as []PrimitiveAlternative, a DefaultAlternative) PrimitiveCase
NewPrimitiveCase creates a primitive case expression.
func NewPrimitiveCaseWithoutDefault ¶
func NewPrimitiveCaseWithoutDefault(e Expression, t types.Primitive, as []PrimitiveAlternative) PrimitiveCase
NewPrimitiveCaseWithoutDefault creates a primitive case expression.
func (PrimitiveCase) Alternatives ¶
func (c PrimitiveCase) Alternatives() []PrimitiveAlternative
Alternatives returns alternatives.
func (PrimitiveCase) Argument ¶
func (c PrimitiveCase) Argument() Expression
func (PrimitiveCase) ConvertTypes ¶
func (c PrimitiveCase) ConvertTypes(f func(types.Type) types.Type) Expression
ConvertTypes converts types.
func (PrimitiveCase) DefaultAlternative ¶
func (c PrimitiveCase) DefaultAlternative() (DefaultAlternative, bool)
func (PrimitiveCase) RenameVariables ¶
func (c PrimitiveCase) RenameVariables(vs map[string]string) Expression
RenameVariables renames variables.
func (PrimitiveCase) VisitExpressions ¶
func (c PrimitiveCase) VisitExpressions(f func(Expression) error) error
VisitExpressions visits expressions.
type PrimitiveOperation ¶
type PrimitiveOperation struct {
// contains filtered or unexported fields
}
PrimitiveOperation is a saturated primitive operation.
func NewPrimitiveOperation ¶
func NewPrimitiveOperation(p PrimitiveOperator, as []Atom) PrimitiveOperation
NewPrimitiveOperation creates a primitive operation.
func (PrimitiveOperation) Arguments ¶
func (o PrimitiveOperation) Arguments() []Atom
Arguments returns arguments.
func (PrimitiveOperation) ConvertTypes ¶
func (o PrimitiveOperation) ConvertTypes(func(types.Type) types.Type) Expression
ConvertTypes converts types.
func (PrimitiveOperation) PrimitiveOperator ¶
func (o PrimitiveOperation) PrimitiveOperator() PrimitiveOperator
PrimitiveOperator returns a primitive operator.
func (PrimitiveOperation) RenameVariables ¶
func (o PrimitiveOperation) RenameVariables(vs map[string]string) Expression
RenameVariables renames variables.
func (PrimitiveOperation) VisitExpressions ¶
func (o PrimitiveOperation) VisitExpressions(f func(Expression) error) error
VisitExpressions visits expressions.
Source Files
¶
- abstract_case.go
- algebraic_alternative.go
- algebraic_case.go
- argument.go
- atom.go
- bind.go
- case.go
- constructor.go
- constructor_application.go
- declaration.go
- default_alternative.go
- expression.go
- float64.go
- function_application.go
- lambda.go
- lambda_declaration.go
- let.go
- literal.go
- module.go
- primitive_alternative.go
- primitive_case.go
- primitive_operation.go
- utilities.go
- variable.go