Use `Int` for capacity in `TBQueue` interface again?
- Dominant language
- Haskell
- Stars
- 118
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
In https://github.com/haskell/stm/pull/17 / https://github.com/haskell/stm/commit/22219489b37b48a981b6f833aaee1226bff86405, the type for the capacity of `TBQueue`s was changed from `Int` to `Natural`, to avoid negative capacities. With https://github.com/haskell/stm/pull/70, the capacity is now internally stored as an `Int` (since array lengths are `Int`s), so IMO it would make sense to change the public API back to `Int`s. Moreover, we need to check that the capacity is greater than 0 anyway and currently we additionally have to check that the capacity is not greater than `maxBound :: Word`. This would also avoid potentially having to unbox/box `Natural`s.
Contributor guide
No contributing guide indexed for this repository
Research direction
Review PR #17 and commit 22219489b37b48a981b6f833aaee1226bff86405 alongside PR #70 to understand the TBQueue capacity API and its internal representation. The change is complete when the public capacity type is Int, positive-capacity validation remains correct, and the unnecessary upper-bound check for Natural is removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100