skip to content

gen-dispatch

gen-dispatch is relational rule dispatch — the guard→effect dispatch step, implemented as a pure Nix library. Ordering comes from gen-graph; gen-dispatch threads context between groups in that order and classifies actions without interpreting them.

The problem it owns: policy-like rules — “if this context matches, enrich it and produce a typed action” — need a dispatch step that stays out of the business of deciding what those actions mean. gen-dispatch classifies; it never interprets. That split is what lets the same dispatch mechanism serve callers with completely different action vocabularies.

It depends only on gen-prelude. No roster member currently builds on it — it’s meant to be taken directly by a caller with its own action vocabulary, gen-dispatch’s fx classification underneath.

{
inputs.gen-dispatch.url = "github:sini/gen-dispatch";
outputs = { gen-dispatch, ... }:
let dispatch = gen-dispatch.lib;
in { /* ... */ };
}
let
dispatch = gen-dispatch.lib;
graph = gen-graph.lib;
fx = dispatch.mkActions {
structural = [ "spawn" "enrich" ];
resolution = [ "edge" ];
};
in
# ...
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).