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

Overflow bugs in takeR, dropR, splitAtR

Open
#1,267 0 comments 0 reactions 0 assignees View on GitHub

@meooow25 is already working on this.

Since Oct 26, 2026.

  • #1268 by @meooow25 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
25/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
haskell
Domain
backend

Research direction

The issue points to containers/src/Data/Sequence/Internal.hs lines 3833–3839, where takeR, dropR, and splitAtR are defined. Read those definitions and check the supplied splitAtR examples with very large negative indices; done means all three functions handle the overflow case correctly. A linked open pull request (#1268) is already addressing this issue.

Written by the indexing model from the issue text.

Description

bug Seq

These recently added functions are defined like

https://github.com/haskell/containers/blob/953428ad079d5708df696442f9bdeaccd1acfc6c/containers/src/Data/Sequence/Internal.hs#L3833-L3839

and the length xs - i can overflow if someone supplies a very large negative i.

λ> Seq.splitAtR (negate maxBound + 1) (Seq.singleton ()) -- this is fine, (1 + maxBound - 1) fits
(fromList [()],fromList [])
λ> Seq.splitAtR (negate maxBound) (Seq.singleton ()) -- (1 + maxBound) overflows, result should be same as above
(fromList [],fromList [()])

Noticed this while working on #83. I will put up a fix in a bit.

Dominant language
Haskell
Stars
356
Forks
196
PR merge metrics
No merged PRs in 30d

Getting set up

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/containers

All issues in haskell/containers

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.