Expand description
Pure function combinators for the Set category (INV-599): identity, compose, pipe, first_match.
compose(g, f)(x) == g(f(x)) (right to left) and pipe(f, g)(x) == g(f(x)) (left to right).
Both are associative with identity as unit.
first_match(rules, x) searches an ordered rule table (INV-626). A rule declines with None and
answers with Some(value), so a rule whose value type is itself an Option can answer Some(None).
Functionsยง
- compose
- Right-to-left composition:
compose(g, f)(x) == g(f(x)). - first_
match - The answer of the first rule in table order that matches
value, orNonewhen none does. - identity
id_A(x) = x.- pipe
- Left-to-right composition:
pipe(f, g)(x) == g(f(x)).