# `DoubleDown.Contract.Dispatch.Types`
[🔗](https://github.com/mccraigmccraig/double_down/blob/main/lib/double_down/contract/dispatch/types.ex#L1)

Shared type definitions for DoubleDown dispatch.

Used by `HandlerMeta`, `CanonicalHandlerState`, and other dispatch
modules to avoid duplicating function type signatures.

# `stateful_fun`

```elixir
@type stateful_fun() ::
  (module(), atom(), [term()], term() -&gt; {term(), term()})
  | (module(), atom(), [term()], term(), map() -&gt; {term(), term()})
```

A stateful handler function — either 4-arity (own state) or 5-arity
(own state + cross-contract state snapshot).

* 4-arity: `fn contract, operation, args, state -> {result, new_state} end`
* 5-arity: `fn contract, operation, args, state, all_states -> {result, new_state} end`

# `stateless_fun`

```elixir
@type stateless_fun() :: (module(), atom(), [term()] -&gt; term())
```

A stateless handler function: `fn contract, operation, args -> result end`.

---

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