hask.Data.Traversable
– The Data.Traversable
¶
-
class
hask.Data.Traversable.
Traversable
[source]¶ Functors representing data structures that can be traversed from left to right.
Dependencies:
Attributes:
traverse
sequenceA
mapM
sequence
Minimal complete definition:
traverse
-
hask.Data.Traversable.
traverse
(*args, **kwargs)¶ traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
Map each element of a structure to an action, evaluate these these actions from left to right, and collect the results. actions from left to right, and collect the results. For a version that ignores the results see
traverse_
.
-
hask.Data.Traversable.
sequenceA
(*args, **kwargs)¶ sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a)
Evaluate each action in the structure from left to right, and and collect the results. For a version that ignores the results see
sequenceA_
.
-
hask.Data.Traversable.
mapM
(*args, **kwargs)¶ mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
Map each element of a structure to a monadic action, evaluate these actions from left to right, and collect the results. For a version that ignores the results see
mapM_
.
-
hask.Data.Traversable.
sequence
(*args, **kwargs)¶ sequence :: (Traversable t, Monad m) => t (m a) -> m (t a)
Evaluate each monadic action in the structure from left to right, and collect the results. For a version that ignores the results see
sequence_
.
-
hask.Data.Traversable.
for1
(*args, **kwargs)¶ for1 :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)
for1 is traverse with its arguments flipped. For a version that ignores the results see
for1_
.
-
hask.Data.Traversable.
forM
(*args, **kwargs)¶ forM :: (Traversable t, Monad m) => t a -> (a -> m b) -> m (t b)
forM is mapM with its arguments flipped. For a version that ignores the results see
forM_
.
-
hask.Data.Traversable.
mapAccumL
(*args, **kwargs)¶ mapAccumL :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
The mapAccumL function behaves like a combination of fmap and foldl; it applies a function to each element of a structure, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new structure.
-
hask.Data.Traversable.
mapAccumR
(*args, **kwargs)¶ mapAccumR :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
The mapAccumR function behaves like a combination of fmap and foldr; it applies a function to each element of a structure, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new structure.