Examples

Runnable example projects for the eparch library. Each example is a self-contained Gleam project with unit / integration tests.

cd examples/<example>
gleam test

State Machine (gen_statem)

ExampleDescription
push-buttonBasic state transitions, synchronous calls, press counter
simple-door-lockShows how to use with_state_enter, StateTimeout for auto-lock, wrong-code tracking

Push-Button

The canonical OTP gen_statem example from the official docs.

Door Lock

A code-protected door lock. Also an example from the docs.

Event Handler (gen_event)

ExampleDescription
terminal-loggerFan-out broadcasting via notify, multiple handlers with independent state, on_terminate cleanup

Terminal Logger

A pair of gen_event handlers wired to a single event bus. Modelled after the canonical error_man example from the OTP docs.

Search Document