Maybe
- class fpylib.functors.maybe.Maybe(value: Optional[fpylib.types._T] = None)[source]
This is a implementation of the Maybe Monad of Haskell. It is a functor, applicative and monad.
- bind(func: Callable[[fpylib.types._T], fpylib.types._S]) fpylib.functors.maybe.Maybe[fpylib.types._S][source]
Return a Just pr Nothing value based on if occur an error or not.
- Parameters
func (Callable[[T], S]) – The function to be applied.
- Returns
Just value or Nothing
- unit(value: fpylib.types._T) fpylib.functors.maybe.Maybe[fpylib.types._T][source]
Return a Just pr Nothing value based on if the value is None or not.
- Parameters
value (T) – The value to be checked.
- Returns
Just value or Nothing
- fpylib.functors.maybe.maybe_conditioner(func: Callable[[...], fpylib.types._T]) Callable[[...], fpylib.functors.maybe.Maybe[fpylib.types._T]][source]
Conditioner for Maybe.
- Parameters
func (Callable[..., T]) – The function to wrap in a Monad.
- Returns
The wrapped function.
- Return type
Callable[…, Monad[T]]