bend
What it does
Section titled “What it does”bend draws from Haskell profunctor optics, Scala’s Either, the adapt primitive from nfx, and parser combinators. A validator that returns true for a non empty list throws away the proof it just computed. A bend lens instead returns left empty or right { head; tail; }, so the data structure carries the proof. Every lens either refines data as proof on right or surfaces invalid data on left.
Its combinator names deliberately match parser combinator vocabulary. bend is a parser combinator library that operates on Nix data structures instead of character streams, and also supports bidirectional writes.
Key features
Section titled “Key features”- Parse, Don’t Validate, refinements return proofs, not booleans
- Bidirectional lenses, read and write through the same optic
- Parser-combinator vocabulary, familiar combinators over Nix data
- Zero dependencies, and 0ver versioning
Role in the ecosystem
Section titled “Role in the ecosystem”bend is the data, validation, and optics foundation. It supplies zen’s module merge (N → 1) and type-checking, and complements nfx’s algebraic effects with structured, proof-carrying transformations.