Functor
- class fpylib.functors.functor.Functor(value: Optional[fpylib.types._T] = None)[source]
Class Functor is a generic class that implements the Functor type class.
- Parameters
value (T) – The value of the functor.
- Returns
A functor with the given value.
- fmap(func: Callable[[fpylib.functors.functor.Functor[fpylib.types._T]], fpylib.functors.functor.Functor[fpylib.types._S]]) fpylib.functors.functor.Functor[fpylib.types._S][source]
Apply a function to the value of the functor.
- Parameters
func (Callable[["Functor[T]"], "Functor[S]"]) – The function to apply.
- Returns
A functor with the value of the functor after applying the function.
- fpylib.functors.functor.fmap(func: Callable[[fpylib.functors.functor.Functor[fpylib.types._T]], fpylib.functors.functor.Functor[fpylib.types._S]], ft: fpylib.functors.functor.Functor[fpylib.types._T]) fpylib.functors.functor.Functor[fpylib.types._S][source]
This function is a functor’s fmap function.
- Parameters
func – Callable[[Functor[T]], Functor[S]]
ft – Functor[T]
- Returns
Functor[S]