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

Conversation

hdgarrood
Copy link
Contributor

Addresses #71 and #113.

/cc @mtolly can you check whether this works for you? I don't think we need both an ascending and descending version because you can use Data.Monoid.Dual if you want it in the other direction.

@hdgarrood
Copy link
Contributor Author

Also @mtolly I think the newtype I mentioned in #113 does exist: it's App from functors, although it doesn't yet have that Monoid instance. See purescript/purescript-functors#12

@mtolly
Copy link
Contributor

mtolly commented Jul 9, 2017

Yep, looks great to me. Thanks for the help!

foldSubmap :: forall k v m. Ord k => Monoid m => Maybe k -> Maybe k -> (k -> v -> m) -> Map k v -> m
foldSubmap kmin kmax f =
let
tooSmall =
Copy link
Contributor

Choose a reason for hiding this comment

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

Thought: you could use any here to make this a little shorter at the expense of a function call and a dictionary lookup.

@paf31
Copy link
Contributor

paf31 commented Jul 9, 2017

👍 Looks great!

@hdgarrood hdgarrood merged commit 9527ec7 into master Jul 9, 2017
@hdgarrood hdgarrood deleted the foldSubmap branch July 9, 2017 20:09
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.

3 participants