@@ -175,9 +175,9 @@ instance foldableMultiplicative :: Foldable Multiplicative where
175175fold :: forall f m . Foldable f => Monoid m => f m -> m
176176fold = foldMap id
177177
178- -- | Similar to 'foldl', but the result is encapsulated in a monad.
178+ -- | Similar to 'foldl', but the result is encapsulated in a monad.
179179-- |
180- -- | Note: this function is not generally stack-safe, e.g., for monads which
180+ -- | Note: this function is not generally stack-safe, e.g., for monads which
181181-- | build up thunks a la `Eff`.
182182foldM :: forall f m a b . Foldable f => Monad m => (a -> b -> m a ) -> a -> f b -> m a
183183foldM f a0 = foldl (\ma b -> ma >>= flip f b) (pure a0)
@@ -331,24 +331,24 @@ notElem x = not <<< elem x
331331indexl :: forall a f . Foldable f => Int -> f a -> Maybe a
332332indexl idx = _.elem <<< foldl go { elem: Nothing , pos: 0 }
333333 where
334- go cursor elem =
335- case cursor.elem of
334+ go cursor a =
335+ case cursor.elem of
336336 Just _ -> cursor
337337 _ ->
338338 if cursor.pos == idx
339- then { elem: Just elem , pos: cursor.pos }
339+ then { elem: Just a , pos: cursor.pos }
340340 else { pos: cursor.pos + 1 , elem: cursor.elem }
341341
342342-- | Try to get nth element from the right in a data structure
343343indexr :: forall a f . Foldable f => Int -> f a -> Maybe a
344344indexr idx = _.elem <<< foldr go { elem: Nothing , pos: 0 }
345345 where
346- go elem cursor =
347- case cursor.elem of
346+ go a cursor =
347+ case cursor.elem of
348348 Just _ -> cursor
349349 _ ->
350350 if cursor.pos == idx
351- then { elem: Just elem , pos: cursor.pos }
351+ then { elem: Just a , pos: cursor.pos }
352352 else { pos: cursor.pos + 1 , elem: cursor.elem }
353353
354354-- | Try to find an element in a data structure which satisfies a predicate.
0 commit comments