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

unfoldTree is too lazy

Open Beginner friendly
#1,260 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

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

Research direction

Start in containers/src/Data/Tree.hs at lines 490-491 and inspect how unfoldTree constructs a Node. Compare its behavior with unfoldM and the unfoldr examples in the issue. Done means unfoldTree evaluates the tuple strictly enough to match those behaviors, while accounting for the noted breaking change.

Written by the indexing model from the issue text.

Description

major-release strictness Tree

https://github.com/haskell/containers/blob/1a10080b0c9d1f5614e589f4184fde4a2569ee9f/containers/src/Data/Tree.hs#L490-L491

To produce a Node, we should be strict in the tuple.

The current behavior does not match with unfoldM, e.g.

> import Data.Tree
> unfoldTree undefined undefined
Node {rootLabel = *** Exception: Prelude.undefined
> import Data.Functor.Identity
> runIdentity $ unfoldTreeM @Identity undefined undefined
*** Exception: Prelude.undefined

Or with other unfold functions like

> import Data.List
> unfoldr (\_ -> Just undefined) undefined
*** Exception: Prelude.undefined

This will be a breaking change, but it is also unlikely that someone is depending on this excessive laziness.

Dominant language
Haskell
Stars
355
Forks
194
Avg merge
3d 4h
Merged PRs (30d)
7

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.