Skip to content

Commit ea905c3

Browse files
authored
Change foldM type signature to more closely match foldl (#111)
1 parent d6905a6 commit ea905c3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Data/Foldable.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ fold = foldMap identity
177177
-- |
178178
-- | Note: this function is not generally stack-safe, e.g., for monads which
179179
-- | build up thunks a la `Eff`.
180-
foldM :: forall f m a b. Foldable f => Monad m => (a -> b -> m a) -> a -> f b -> m a
181-
foldM f a0 = foldl (\ma b -> ma >>= flip f b) (pure a0)
180+
foldM :: forall f m a b. Foldable f => Monad m => (b -> a -> m b) -> b -> f a -> m b
181+
foldM f b0 = foldl (\b a -> b >>= flip f a) (pure b0)
182182

183183
-- | Traverse a data structure, performing some effects encoded by an
184184
-- | `Applicative` functor at each value, ignoring the final result.

0 commit comments

Comments
 (0)