Skip to content

Add unzip and unzipWith for Map and IntMap #1174

Description

@treeowl

The these package provides an unzip for these types, but it's a "two pass" fmap-based implementation that can leak memory. I suggested a solution using traverseBia from bifunctors, but that was rejected as too hard to understand. @phadej recommended adding the unzipper to containers instead. We can do this fairly simply, and certainly more efficiently than traverseBia can (at least until ekmett/bifunctors#93 eventually reaches Hackage).

I'll try to implement these next weekend; if someone else gives it a shot, they should be mindful of the fairly subtle NOINLINE tricks that tend to be required to ensure we get the selector thunks we want.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions