Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`Size` can be a newtype.

Open
#569 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
haskell
Domain
performance

Research direction

Start by locating the Size definition and its Exact, Max, and Unknown constructors, then trace how Size is stored in Bundle and used by the relevant functions. Confirm that the proposed representation preserves the stated denotational equivalences and supports pattern synonyms, with Size unpacked where possible and no behavioral regressions.

Written by the indexing model from the issue text.

Description

The Exact and Max constructors require a nonnegative Int. Denotationally, Exact 0 is the same as Max 0. There's also unknown. This means you can fit an entire Size into the same space as an Int:

  • Exact n is represented by a non-negative n.
  • Max n is represented by a negative n, where n <= maxBound.
  • Unknown is minBound, because minBound == negate minBound.

Doing so would allow Size to be unpacked in Bundle and various functions. Exact, Max, and Unknown can be pattern synonyms. I feel like this would improve performance somewhat.

Dominant language
Haskell
Stars
401
Forks
145
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from haskell/vector

All issues in haskell/vector

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.