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)

ExampleConcepts demonstrated
01-push-buttonBasic state transitions, synchronous calls, press counter
02-door-lockwith_state_enter, StateTimeout for auto-lock, wrong-code tracking

Push-Button

The canonical OTP gen_statem example from the official docs.

stateDiagram
    Off --> On  : push (count + 1)
    On  --> Off : push

Door Lock

A code-protected door lock.

stateDiagram
    Locked --> Open   : correct code
    Open   --> Locked : timeout
    Locked --> Locked : wrong code (attempts + 1)

eparch/gen_event

Coming soon.

Search Document