hydra.overlay.python.lib.eithers module
Python implementations of hydra.overlay.python.lib.eithers primitives.
- hydra.overlay.python.lib.eithers.bimap(f: Callable[[A], C], g: Callable[[B], D], e: object) object
Map over both sides of an Either value.
- hydra.overlay.python.lib.eithers.bind(e: object, f: Callable[[B], object]) object
Bind (flatMap) for Either: if Right, apply the function; if Left, return unchanged.
- hydra.overlay.python.lib.eithers.either(f: Callable[[A], C], g: Callable[[B], C], e: object) C
Eliminate an Either value by applying one of two functions.
- hydra.overlay.python.lib.eithers.fold_list(f: Callable[[A, B], object], acc: A, xs: tuple) object
Left-fold over a list with an Either-returning function, short-circuiting on Left.
- hydra.overlay.python.lib.eithers.from_left(default: A | Callable[[], A], e: object) A
Extract the Left value, or return a default. The default is lazy (#391).
- hydra.overlay.python.lib.eithers.from_right(default: B | Callable[[], B], e: object) B
Extract the Right value, or return a default. The default is lazy (#391).
- hydra.overlay.python.lib.eithers.left(value: A) object
Construct a Left (error/exceptional) Either value.
- hydra.overlay.python.lib.eithers.lefts(eithers: tuple) tuple
Extract all Left values from a list of Eithers.
- hydra.overlay.python.lib.eithers.map(f: Callable[[A], B], e: object) object
Map a function over the Right side of an Either (standard functor map).
- hydra.overlay.python.lib.eithers.map_left(f: Callable[[A], C], e: object) object
Map a function over the Left side of an Either.
- hydra.overlay.python.lib.eithers.map_list(f: Callable[[A], object], xs: tuple) object
Map a function returning Either over a list, collecting results or short-circuiting on Left.
- hydra.overlay.python.lib.eithers.map_optional(f: Callable[[A], object], mx: object) object
Map a function returning Either over an optional, or return Right(none) if none.
- hydra.overlay.python.lib.eithers.map_right(f: Callable[[B], C], e: object) object
Map a function over the Right side of an Either.
- hydra.overlay.python.lib.eithers.map_set(f: Callable[[A], object], xs: frozenset[A]) object
Map a function returning Either over a set, collecting results or short-circuiting on Left.
- hydra.overlay.python.lib.eithers.partition(eithers: tuple) tuple[tuple, tuple]
Partition a list of Eithers into lefts and rights.
- hydra.overlay.python.lib.eithers.right(value: B) object
Construct a Right (success/normal) Either value.
- hydra.overlay.python.lib.eithers.rights(eithers: tuple) tuple
Extract all Right values from a list of Eithers.