An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          


Sponsor Vic
Ask DeepWiki

Dendritic Nix
License
CI Status

> 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`