Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unionsWith #240

Closed
BebeSparkelSparkel opened this issue Nov 27, 2019 · 5 comments
Closed

unionsWith #240

BebeSparkelSparkel opened this issue Nov 27, 2019 · 5 comments

Comments

@BebeSparkelSparkel
Copy link

unionsWith would be a nice addition

unionsWith :: Foldable f => (NonEmpty a -> b) -> f (HashMap k a) -> HashMap k b

@sjakobi
Copy link
Member

sjakobi commented Jun 18, 2020

Oh, I just noticed that the type signature you're requesting is not the same as in #118:

unionsWith :: (Eq k, Hashable k) => (v -> v -> v) -> [HashMap k v] -> HashMap k v

That one is somewhat closer to the one in containers though:

unionsWith :: (Foldable f, Ord k) => (a -> a -> a) -> f (Map k a) -> Map k a

@BebeSparkelSparkel
Copy link
Author

I still want the a -> b transformation for one or more.

@sjakobi
Copy link
Member

sjakobi commented Jun 20, 2020

Yeah, that would be nice to have. #226 seems like a good road towards that feature. Feel free to chime in there!

@sjakobi
Copy link
Member

sjakobi commented Jun 21, 2020

@BebeSparkelSparkel I'm somewhat confused by your comment #226 (comment).

Could you maybe give us some context regarding the problem you want to solve, so we can better understand your requirements?

@BebeSparkelSparkel
Copy link
Author

Detailed in #244, was my usecase, but switched data structures. However, this still seemed like a useful feature for combining a lot of small mappings. This allows the functions generating the mappings to be more compartmentalized by returning a mapping instead of having to pass a mapping into it and then returning the modified mapping. The downside is that I get all these maps that take up a whole bunch of space that cannot be garbage collected which I was trying to avoid with the fold, #226. I'll close this and defer to #226. I'm quite busy right but @sjakobi if you need some help/review with #226 let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants