Function used to pass-through execution if input is an Exception.
In addition, it currify function.
def x5(x: int) -> int: return x * 5 maybe_x5 = bind(x5) assert maybe_x5(1) == 5 error = maybe_x5(Exception())
Curried functions admit less inputs than mandatory ones and return a function with that inputs fixed.
In this great book is explained better.
def _sum(x: int, y: int) -> int: return x + y maybe_sum = bind(_sum) maybe_sum1 = maybe_sum(1) assert maybe_sum1(4) == 5 error = maybe_sum1(Exception())
@bind def x5(x: int) -> int: return x * 5