bend and vic's dendritic libs made for you with Love++ and AI--. If you like my work, consider sponsoring
Bend. Lens based data parser-combinators. Bidirectional transformation and validation pipelines for Nix.
Bend draws from Haskell profunctor optics, Scala's Either, the adapt primitive from denful/nfx and parser-combinators.
The core idea is Parse, Don't Validate: a validator for non-empty lists that returns true is discarding the proof it just computed; instead if the function returns left empty or right { head; tail; }, the data structure is the proof.
Every lens either refines data as proof on right or returns invalid data on left.
Bend’s combinator names deliberately match parser-combinator vocabulary: This is not cosmetic. The names signal that Bend is a parser combinator library, one that operates on Nix data structures instead of character streams, and that happens to also support bidirectional writes.
Bend has no dependencies
# flake.nix
inputs.bend.url = "github:denful/bend";
bend = inputs.bend.lib;# default.nix
bend = import bend-sources.outPath;Bend uses 0-based versioning. v0.x