Open
Description
What do u guys think about adding some helpers functions like flow & bind, just like returns
already has?
I try to use them and imho its looks better then chain of .and_then().and_then().
result: Result[int, ValueError] = flow(
"1",
bind(str_to_float),
bind(float_to_int),
)
def str_to_float(s: str) -> Result[float, ValueError]:
...
def float_to_int(f: float) -> Result[int, ValueError]:
...
I don't test my code on mypy, but pyright is ok with types of flow & bind, so i think its possible to adapt.
Metadata
Assignees
Labels
No labels