# `ShotDs.Data.Type`
[🔗](https://github.com/jcschuster/ShotDs/blob/v1.0.0/lib/shot_ds/data/type.ex#L1)

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: []}
      ]
    }

# `t`

```elixir
@type t() :: %ShotDs.Data.Type{args: [t()], goal: type_id()}
```

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.

# `type_id`

```elixir
@type type_id() :: atom() | reference()
```

The type of a basic type.

A basic type is identified as an atom (concrete type) or a reference (type
variable).

# `fresh_type_var`

```elixir
@spec fresh_type_var() :: t()
```

Creates a fresh variable for a simple type using Erlang references.

# `new`

```elixir
@spec new(type_id() | t(), type_id() | t() | [type_id() | t()]) :: t()
```

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.

# `type_var?`

```elixir
@spec type_var?(t() | type_id()) :: boolean()
```

Checks whether the given type or type identifier is a type variable.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
