Skip to content

Control Flow Combinators

Replace left with right default.

Apply f to focused value in-place; return updated whole.

bend.over (n: n * 2) (bend.path ["config" "timeout"]) { config = { timeout = 30; }; }
# right { config = { timeout = 60; }; }

Extract raw value or return default on left.

bend.getOr 0 bend.int "bad" # 0

Apply lens only when pred s is true; otherwise right s unchanged.

(bend.when (v: v != null) bend.str).get null # right null

Apply lens only when pred s is false.

Contribute Community Sponsor