haskell / haskell/containers

Add unzip and unzipWith for Map and IntMap

Open
#1,174 8 comments 0 reactions 0 assignees View on GitHub
feature-request IntMap Map
Dominant language
Haskell
Stars
355
Forks
194
Avg merge
3d 4h
Merged PRs (30d)
4

Description

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](https://github.com/haskellari/these/pull/164). We can do this fairly simply, and certainly more efficiently than `traverseBia` can (at least until https://github.com/ekmett/bifunctors/pull/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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.