Traversable
0.40.0
Definitions
def
for
[taefmb]
(
t :
t[a]
f :
a -> m[b] \ ef
)
: m[t[b]]
\ ef
with
Applicative[m]
Traversable[t]
Returns the result of applying the applicative mapping function f
to all the elements of the
data structure t
.
for
is traverse
with it's arguments flipped.
def
mapAccumLeft
[accaefbt]
(
f :
acc -> (a -> (acc, b) \ ef)
start :
acc
t :
t[a]
)
: (acc, t[b])
\ ef
with
Traversable[t]
Returns the result of applying f
to the traversable structure t
and the initial state acc
.
The result is a pair of the final state and the updated copy of the structure.
mapAccumLeft
is essentially the combination of map
and foldLeft
- like map it returns an updated copy
of the initial structure, like foldLeft
it passes an updating accumulator through each step of the traversal.