Skip to content

Parsing and evidence

How a value earns a stronger type: by being parsed once at a boundary, into a type whose construction is the evidence. Part of Type-driven design.

  • Parse, don’t validate: what’s wrong with validating, shotgun parsing, partial functions made total, where to parse, and where it gets harder.
  • How strong the evidence is: smart constructors and newtypes, constructive and encapsulated types, hidden constructors, and evidence without runtime cost.
  • Types at the boundary: trust boundaries, DTOs and serialization, the database as a boundary, evolving types, and tolerant readers.

Explore this section

  • How much a parsed type guarantees: smart constructors and newtypes, constructive versus encapsulated types, names that are not type safety, constructors that bypass the check, and evidence without runtime cost.

  • Alexis King's principle: parse input at the boundary into types that keep what was checked, instead of validating and passing on weak types. Shotgun parsing, partial functions made total, and where parsing gets harder.

  • Where the trust boundaries are, how domain types map to the shapes that cross them (DTOs, rows and messages), and what happens when those shapes change while old data stays where it was written.