Provides a data structure for Church's simple types.
Examples
iex> o = Type.new(:o)
%ShotDs.Data.Type{goal: :o, args: []}
iex> io = Type.new(:o, :i)
%ShotDs.Data.Type{goal: :o, args: [%ShotDs.Data.Type{goal: :i, args: []}]}
iex> Type.new(io, [o, :o])
%ShotDs.Data.Type{
goal: :o,
args: [
%ShotDs.Data.Type{goal: :i, args: []},
%ShotDs.Data.Type{goal: :o, args: []},
%ShotDs.Data.Type{goal: :o, args: []}
]
}
Summary
Functions
Creates a fresh variable for a simple type using Erlang references.
Creates a new simple type. Optionally, a list of arguments can be specified.
Checks whether the given type or type identifier is a type variable.
Types
The type of a simple type.
The goal can be a concrete name for the type like :i or :o or a reference
denoting a type variable. The arguments of a type are a list of simple types.
Note that this is an uncurried representation of higher-order types.
The type of a basic type.
A basic type is identified as an atom (concrete type) or a reference (type variable).
Functions
@spec fresh_type_var() :: t()
Creates a fresh variable for a simple type using Erlang references.
Creates a new simple type. Optionally, a list of arguments can be specified.
Behaves as identity function on a single argument representing a simple type.
Checks whether the given type or type identifier is a type variable.