haskell / haskell/containers

More accurate Set and Map size warnings

Open
#1,010 3 comments 0 reactions 0 assignees View on GitHub
docs Map Set
Dominant language
Haskell
Stars
355
Forks
194
Avg merge
3d 4h
Merged PRs (30d)
4

Description

`Set` and `Map` documentation carry warnings that say

> The size of the set must not exceed `maxBound::Int`. Violation of this condition is not detected and if the size limit is exceeded, its behaviour is undefined.

However, we multiple sizes by `delta = 3` without caring about overflow when balancing, which means we get violated invariants earlier than that.

I doubt anyone will be running into this in practice, but the limit should be document as ``maxBound `div` 3`` perhaps. Or less, in case there are other potentially troublesome operations I missed.

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.