Is there an example of the Haskell analog 'mapM wi...
# arrow
j
Is there an example of the Haskell analog 'mapM with IO' in arrow core or arrow fx ? I want to build a List (or Traversable, ..) of IO actions, and run them by mapM'ing over that data. is it only foldMapM from ListKFoldable ? or is there a more compact way somewhere ?
s
You’re looking to transform
List<A>
into
IO<B>
using
(B, A) -> B
?
In that case you’d want to use
foldMapM
from
Foldable
yes.
Copy code
listOf(1, 2, 3).foldMapM(IO.monad()) { acc, i ->
   IO { acc + i }
} // IO(6)
j
exactly, thx!