@@ -9,20 +9,28 @@ import Prelude.Functor
99
1010%access public export
1111
12+||| Map each element of a structure to a computation, evaluate those
13+||| computations and discard the results.
1214traverse_ : (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
1315traverse_ f = foldr ((*>) . f) (pure ())
1416
17+||| Evaluate each computation in a structure and discard the results
1518sequence_ : (Foldable t, Applicative f) => t (f a) -> f ()
1619sequence_ = foldr (*>) (pure ())
1720
21+||| Like `traverse_` but with the arguments flipped
1822for_ : (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
1923for_ = flip traverse_
2024
2125interface (Functor t, Foldable t) => Traversable (t : Type -> Type) where
26+ ||| Map each element of a structure to a computation, evaluate those
27+ ||| computations and combine the results.
2228 traverse : Applicative f => (a -> f b) -> t a -> f (t b)
2329
30+||| Evaluate each computation in a structure and collect the results
2431sequence : (Traversable t, Applicative f) => t (f a) -> f (t a)
2532sequence = traverse id
2633
34+||| Like `traverse` but with the arguments flipped
2735for : (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)
2836for = flip traverse