containers v0.7.0 Containers.Mappable protocol View Source

Protocol for implementing Mappable actios using the map function

Link to this section Summary

Functions

Map takes a Mappable as struct and runs some function f on the vlaue, and returns the same struct

Link to this section Types

Link to this section Functions

Map takes a Mappable as struct and runs some function f on the vlaue, and returns the same struct.

Say you have:

an_optional = Containers.Optional.to_optional(1)

def add_one(n), do: n + 1

Containers.Mappable.map(an_optional, &add_one/1)

%Containers.Optional{value: 2}