arrow-core-data / arrow.typeclasses / Foldable / foldM
open fun <G, A, B> Kind<F, A>.foldM(M:
Monad
<G>, z: B, f: (B, A) -> Kind<G, B>): Kind<G, B>
Left associative monadic folding on F.
The default implementation of this is based on foldL, and thus will always fold across the entire structure. Certain structures are able to implement this in such a way that folds can be short-circuited (not traverse the entirety of the structure), depending on the G result produced at a given step.
Do you like Arrow?
✖