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

Overflow in size hints in bundles

Open
#406 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
haskell
Domain
performance

Research direction

Start with src/Data/Vector/Fusion/Bundle/Size.hs, especially the checkedAdd path shown in the failure, and reproduce the example from the issue. Trace how exact lengths and upper bounds are represented and test the proposed overflow semantics: upper-bound overflow should become unbounded, while lower-bound overflow should still error. Add regression coverage for the reported bundle case.

Written by the indexing model from the issue text.

Description

Consider following program:

import qualified Data.Vector.Unboxed as U

main :: IO ()
main = do
  print $ U.take 4 $ U.generate (maxBound - 4) id
                U.++ U.generate (maxBound - 4) id

One could think that it will print [0,1,2,3] provided it will fuse. It however fails with.

overflow: Data.Vector.Fusion.Bundle.Size.checkedAdd: overflow: -10
CallStack (from HasCallStack):
  error, called at src/Data/Vector/Fusion/Bundle/Size.hs:56:7 in vector-0.13.0.1-KtkGVThkqZeLj5OVQdyUBP:Data.Vector.Fusion.Bundle.Size

This happens because computation of both exact vector length and upper bound on vector size throws error if it overflows Int. I wasn't able to craft example which overflows maximum bound on length which is much more realistic.

This issue is mostly to record that error on error on overflow could cause problems. I'd propose following semantics change: overflow for upper bound on vector size reverts to unbounded. Overflow for lower bound does cause error. (Note not expressible with current implementation of size)

Related: #388

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.