Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Add Functor/Foldable/TraversableWithIndex for Map #126

Merged
merged 2 commits into from
Nov 30, 2017
Merged

Add Functor/Foldable/TraversableWithIndex for Map #126

merged 2 commits into from
Nov 30, 2017

Conversation

garyb
Copy link
Member

@garyb garyb commented Nov 29, 2017

I implemented FoldableWithIndex stupidly, the same way Foldable is, as I figured it would be stack safe at least. But then the FunctorWithIndex isn't... so whatever! We should re-examine both instances at some point I guess.

@garyb garyb requested a review from paf31 November 29, 2017 11:36
foldrWithIndex f z m = foldr (uncurry f) z $ asList $ toUnfoldable m
foldMapWithIndex f m = foldMap (uncurry f) $ asList $ toUnfoldable m

asList ∷ ∀ k v. List (Tuple k v) → List (Tuple k v)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unicode here :)

Copy link
Contributor

@paf31 paf31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM, just one unicode char to fix if we want to keep things in ASCII in core.

@garyb garyb merged commit a4ebe6a into master Nov 30, 2017
@garyb garyb deleted the with-index branch November 30, 2017 20:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants