containers v0.6.2 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
Link to this function
map(struct, f)
View Source
map(Containers.mappable, (any -> Containers.mappable)) :: Containers.mappable
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}