https://github.com/denful/bend
Lens based data parser-combinators. Bidirectional transformation and validation pipelines for Nix.
https://github.com/denful/bend
data-access-library lens lenses nix parse-dont-validate parser-combinators validation-library
Last synced: about 1 month ago
JSON representation
Lens based data parser-combinators. Bidirectional transformation and validation pipelines for Nix.
- Host: GitHub
- URL: https://github.com/denful/bend
- Owner: denful
- License: apache-2.0
- Created: 2026-05-11T21:33:02.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-05-16T06:25:49.000Z (about 1 month ago)
- Last Synced: 2026-05-17T06:03:01.654Z (about 1 month ago)
- Topics: data-access-library, lens, lenses, nix, parse-dont-validate, parser-combinators, validation-library
- Language: Nix
- Homepage: http://bend.denful.dev/
- Size: 965 KB
- Stars: 6
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
> bend and [vic](https://bsky.app/profile/oeiuwq.bsky.social)'s [dendritic libs](https://dendritic.oeiuwq.com) made for you with Love++ and AI--. If you like my work, consider [sponsoring](https://dendritic.oeiuwq.com/sponsor)
# **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](https://github.com/denful/nfx) and parser-combinators.
The core idea is [Parse, Don't Validate](https://lexi-lambda.github.io/blog/2019/11/05/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](https://bend.denful.dev/explanation/validation-is-parsing), one that operates on Nix data structures instead of character streams, and that happens to also support bidirectional writes.
## **[Documentation at https://bend.denful.dev](https://bend.denful.dev)**
## Install
Bend has no dependencies
```nix
# flake.nix
inputs.bend.url = "github:denful/bend";
bend = inputs.bend.lib;
```
```nix
# default.nix
bend = import bend-sources.outPath;
```
## [zer0ver](https://0ver.org)
Bend uses 0-based versioning. `v0.x`