Skip to content

Type Parsers & Predicates

right when value is integer; left otherwise.

right when value is string; left otherwise.

right when value is bool; left otherwise.

right when value is list; left otherwise.

right when value is float; left otherwise.

right when value is int or float; left otherwise.

right s when pred s is true; left s otherwise.

right when pred passes; uses lens for value focus.

right { head; tail; } when list is non-empty; left [] when empty.

bend.nonEmpty.get [ 1 2 3 ] # right { head = 1; tail = [ 2 3 ]; }
bend.nonEmpty.get [ ] # left [ ]

right when string is non-empty; left when empty or not a string.

Pass null as right null; apply lens to non-null values.

(bend.optional bend.str).get null # right null
(bend.optional bend.str).get "hi" # right "hi"
(bend.optional bend.str).get 42 # left 42

Combine two predicates with AND.

Combine two predicates with OR.

Negate a predicate.

Apply pure function f to focused value (wraps result in right).

Contribute Community Sponsor