haskell / haskell/containers

Strict maps as newtypes

Open
#1,124 13 comments 3 reactions 0 assignees View on GitHub
discussion/rfc IntMap Map
Dominant language
Haskell
Stars
355
Forks
194
Avg merge
3d 4h
Merged PRs (30d)
4

Description

Currently we have Lazy and Strict modules for Map and IntMap that act on the same type, which is a potential source of confusion and bugs.

An arguably better situation would be to have strict maps as newtypes over lazy maps. This will prevent maps from being used with the wrong module and allow strict maps to have their own instances. At the same time, it will remain possible to explicitly convert between the types in constant time.

However,

* Do users want to use separate strict types? The [`strict-containers`](https://hackage.haskell.org/package/strict-containers) library exists today, but isn't widely used(?)
* To avoid breakage, it would be best to have this newtype in a separate module. Having two strict modules would be confusing, how do we address that?
* If we were to consider a breaking change and change the Strict module to work on a newtype, what amount of breakage would we see?

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.