skip to content

gen-algebra

gen-algebra is foundational primitives for the gen family: a search monad, intensional functions, standalone identity hashing, record algebra with scoped labels, and Either combinators. Nothing here knows about graphs, scopes, or aspects — it’s the vocabulary those libraries are written in.

The problem it owns: a handful of algebraic shapes — nondeterministic search, layered record merging, a value that is “this or that” — show up over and over across the roster, and each one has a right answer that is easy to get subtly wrong by hand. gen-algebra gets them right once.

It is builtins-only: zero flake inputs, a stated contract enforced by its own purity suite. Four roster members build on it: gen-link, gen-schema, gen-select, and gen-settings.

{
inputs.gen-algebra.url = "github:sini/gen-algebra";
outputs = { gen-algebra, ... }:
let
search = gen-algebra.lib.search;
inherit (gen-algebra.lib) mkIntensional conservativeEq record either;
in
{ /* ... */ };
}

Without flakes, import ./path/to/gen-algebra { } gets you the same value — the non-flake entry is a nullary function, { } applies it.

palette
dark
light
↑↓ select apply esc close

Palettes adapted from Catppuccin (Macchiato) (MIT), Tokyo Night (Apache-2.0), gruvbox (MIT), Catppuccin (Latte) (MIT), Rosé Pine (Dawn) (MIT).