Skip to content

Conversation

@treeowl
Copy link

@treeowl treeowl commented Aug 22, 2021

The previous Map (same for IntMap throughout) instance
would first map eagerly over tha Map, producing an entire
Map full of thunks to apply the unzipWith function. Then
it would build two more entire Maps full of thunks to select
components of each pair. Depending on inlining and such, the
resulting maps may or may not have contained selector thunks;
if not, they could leak memory. Fix that.

NOTE: This PR is an alternative to #163. This one preserves
the precise laziness properties of the previous implementation.

The previous `Map` (same for `IntMap` throughout) instance
would first map eagerly over tha `Map`, producing an entire
`Map` full of thunks to apply the `unzipWith` function. Then
it would build two more entire `Map`s full of thunks to select
components of each pair. Depending on inlining and such, the
resulting maps may or may not have contained selector thunks;
if not, they could leak memory. Fix that.

NOTE: This PR is an alternative to haskellari#163. This one preserves
the precise laziness properties of the previous implementation.
@phadej
Copy link
Collaborator

phadej commented Jan 4, 2026

I don't understand what happens here. I'll be happier if containers provided unzip for Maps`.

@treeowl
Copy link
Author

treeowl commented Jan 4, 2026

I've opened haskell/containers#1174 to address this upstream.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants