Error Messages & Annotations
label msg lens
Section titled “label msg lens”Replace left with fixed message.
(bend.label "expected integer" bend.int).get "hello"# left "expected integer"annotate path lens
Section titled “annotate path lens”Wrap left with { path; got; }.
(bend.annotate ["user" "age"] bend.int).get "thirty"# left { path = ["user" "age"]; got = "thirty"; }annotateWith f lens
Section titled “annotateWith f lens”Like annotate but f got computes the annotation.
ensure pred msg lens
Section titled “ensure pred msg lens”Check predicate and label failure in one step.
(bend.ensure (s: s != "") "name cannot be empty" bend.str).get ""# left "name cannot be empty"defaultPathError
Section titled “defaultPathError”Default error shape for named-step pipe: { path; got; }.