Std. Functor
(Cure Standard Library v0.37.2)
View Source
Functor interface for structures that support fmap.
A functor is any container F that admits a structure-preserving
map. Functor is genuinely higher-kinded: its head f has kind
Type -> Type, so fmap lifts a function A -> B to F(A) -> F(B).
The built-in implementation for List delegates to Std.List.map/2;
additional implementations can be declared for user-defined container
types.
Examples
use Std.Functor
fmap([1, 2, 3], fn(x) -> x + 10) # => [11, 12, 13]
Summary
Callbacks
Group tag consumed by Cure.Stdlib.Preload.
Functor(F) lifts an arbitrary function A -> B to a
structure-preserving transformation F(A) -> F(B).
Functions
Apply g to every element inside the functorial container.