Managing the Type Boundary: Gleam FFI for the BEAM
Learn how Gleam's FFI interacts with the BEAM, the risks of the trust boundary between static and dynamic types, and how to verify external function signatures using Dialyzer.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Learn how Gleam's FFI interacts with the BEAM, the risks of the trust boundary between static and dynamic types, and how to verify external function signatures using Dialyzer.
When exposing APIs in Gleam, typed structs combined with the gleam/json library give compile‑time guarantees and runtime safety. This architecture note walks through the minimal design, trust boundaries, operational checks, and failure modes that shape a dependable payload layer.
Gleam's `use` keyword turns nested Result case expressions into flat, readable sequences. See how it desugars, where it helps, and what to watch for.
Gleam's custom types make invalid states unrepresentable by forcing exhaustive pattern matching, turning runtime bugs into compile-time errors.
A practical look at using Gleam custom types and exhaustive pattern matching to replace fragile string status fields, with a worked example and honest trade-offs.
Learn how to use gleam_otp to implement Erlang gen_server behaviours and supervision trees in Gleam, with concrete build and verification steps for the Erlang target.
Gleam’s type‑classes enable compile‑time polymorphism with no runtime overhead. This blog explains how they work, shows a JSON encoder example, discusses ambiguity, performance, and when to use them.
Build a small Gleam module that models a missing value with Option, run it, and confirm the compiler rejects a match that forgets None.
Learn when to use Result types versus panics in Gleam to balance type safety with code readability and system stability.