Primitives
Typed values implemented in Rust through PyO3. The workflow, agent and Kafka packages build on them.
Either, Option and Try follow Scala’s standard library, Validated follows Cats, and IList/IMap are immutable and structurally shared like Scala’s List/Map. @sealed and @case with match correspond to sealed trait and case class, and do-notation to the for-comprehension. Methods use snake_case (flat_map, get_or_else).
- Either: a value or an error, without exceptions.
- Validated: like
Either, but accumulates every error. - Option: present or absent.
- Try: a result or the exception that broke it.
- Collections:
IList,IMapandISet. - NonEmptyList:
headandreduceare total. - Numeric lists: compact typed lists for
intandfloat. - IntSet: a Roaring-bitmap set of integers.
- Duration: a typed time span.
- serde: typed encode and decode.
- par_map: process-parallel map.
from pyrula import Either, Validated, Option, TryEither[T, E] and Validated[T, E] put the success type first. Cases subclass the generic base, so isinstance(Ok(1), Either) holds, and payload-bearing cases support positional match patterns. Nothing is a singleton.
traverse and sequence collect results into a list. Either, Option and Try stop at the first failure; Validated runs every check.
Also: Modeling with @case, Composition, Examples.