Control Flow Combinators
option default lens
Section titled “option default lens”Replace left with right default.
over f lens s
Section titled “over f lens s”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; }; }getOr default lens s
Section titled “getOr default lens s”Extract raw value or return default on left.
bend.getOr 0 bend.int "bad" # 0when pred lens
Section titled “when pred lens”Apply lens only when pred s is true; otherwise right s unchanged.
(bend.when (v: v != null) bend.str).get null # right nullunless pred lens
Section titled “unless pred lens”Apply lens only when pred s is false.