Often we want to iterate through a collection of items, performing some effect for each item. This means we want some function that looks like
(a -> f b) -> t a -> result
where a -> f b
is our effectful computation, t a
is our collection (of a
s) and result
could take a few different shapes depending on the requirements of our program, especially in the common case when the effect f
encapsulates some notion of failure (like TaskEither
in fp-ts
, or anything with ExceptT
in its stack in Haskell
).
[!TIP]