# Thunk


Runtime carrier module. Three exports:

  mkThunk    : a       -> Thunk a
  forceThunk : Thunk a -> a
  isThunk    : Value   -> Bool

A `Thunk` is `{ _tag = "Thunk"; _force = _: value; }`. The value is
captured in the closure's environment, where `builtins.deepSeq` cannot
reach it. The companion HOAS combinator `H.thunk inner` provides the
structurally-lazy kernel type former.

This carrier is intentionally runtime-only: the HOAS `thunk`
combinator supplies the typed surface, and handlers use the carrier
to keep state transport lazy under trampoline evaluation.

## `forceThunk`

_forceThunk: recover the value hidden inside a Thunk carrier; rejects raw values and malformed carriers._

```
forceThunk : Thunk a -> a
```

Recover the value captured inside a `Thunk` carrier.

## `isThunk`

_isThunk: predicate recognizing Thunk carriers by their `_force` closure._

```
isThunk : Value -> Bool
```

Return true when a value has the Thunk carrier shape.

## `mkThunk`

_Thunk: deepSeq-safe carrier for transporting values through trampoline-threaded handler state via a closure that hides the value from `builtins.deepSeq`._

```
mkThunk : a -> Thunk a
```

A `Thunk` is `{ _tag = "Thunk"; _force = _: value; }`. The value is
captured in the closure's environment, where `builtins.deepSeq` cannot
reach it. The companion HOAS combinator `H.thunk inner` provides the
structurally-lazy kernel type former.

This carrier is intentionally runtime-only: the HOAS `thunk`
combinator supplies the typed surface, and handlers use the carrier
to keep state transport lazy under trampoline evaluation.

