nfx
What it does
Section titled “What it does”nfx brings structured algebraic effects to the Nix language. The kernel provides four primitives:
- immediate, an effect with a resolved value
- pending, an effect awaiting context
- adapt, transform context and continuation
- runFx, evaluate an effect once its requirements are satisfied
Everything else is derived from these.
Key features
Section titled “Key features”- Core system,
kernel,basic(pure/value lifting),functor(map/contraMap),monad(mapM/flatMap/then’),provide(dependency injection),sequence(do-notation) - Context management,
statethreading,context,requestcapabilities,handlers,lens,pair,and,zip - Specialized effects,
conditions(Common Lisp style resumable signals, handlers, restarts),result,bracket(guaranteed cleanup),rw(reader/writer),acc(accumulators),choice(non-deterministic backtracking),arrow
Role in the ecosystem
Section titled “Role in the ecosystem”nfx is the algebraic-effects foundation for Nix. It underpins higher-level functional libraries in the ecosystem, composing naturally with pipe’s freer monad pipelines and powering stream and reactivity-oriented work like ned and zen. It is the Nix member of a cross-language effects family alongside fx.go and fx-rs.
Source Code Support this project