Std.Functor

View source →

Functor protocol for structures that support fmap.

A functor is any container that admits a structure-preserving map. The built-in impl for List delegates to Std.List.map/2; additional impls can be declared for user-defined container types.

Examples

use Std.Functor

fmap([1, 2, 3], fn(x) -> x + 10)        # => [11, 12, 13]

Protocols

  • proto Functor(F)

    Functor(F) lifts an arbitrary function A -> B to an endo-transformation on a container F.

Functions

  • # fn __group__() -> Atom

    Group tag consumed by Cure.Stdlib.Preload.

  • # fn fmap(container: List(Any), f: (A) -> B) -> List(Any)

    Map f over every element of container.