pipe
What it does
Section titled “What it does”Calling pipe with a list of operations is a do pipeline over the Id monad. Because M a = a for Id, all Nix values work without any wrapping:
let x = pipe [ (n: n * 2) (n: n + 1) ]; y = pipe [ (n: n / 2) (n: n - 1) ]; z = pipe [ x y ]; # subpipes are first classin z 100You can also define your own monad instances (the library ships Id and Maybe). Pipelines can be generic over the monad type and run unchanged on different instances.
Key features
Section titled “Key features”- Drop in
lib.pipe, composable|>with first class subpipes - Freer monad core,
dostyle sequencing over any monad - Bring your own monad, define
pure/bind/isMfor custom instances - Monad generic pipelines, write once, run on
Id,Maybe, or your own
Role in the ecosystem
Section titled “Role in the ecosystem”pipe is the lightweight functional glue of the ecosystem, monadic composition without ceremony. It pairs naturally with nfx’s algebraic effects when you need structured sequencing in plain Nix.
Source Code Support this project