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

Set/Map fromList using sorting

Open
#1,263 3 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
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
haskell
Domain
data

Research direction

Start by locating the Set fromList implementation and the existing STUArray-based DFS code mentioned in the issue. Explore whether sorting a mutable array and building a Set preserves the expected behavior and performance, including already sorted input and GHC-specific CPP maintenance. Done means demonstrating the approach’s allocation and speed tradeoffs and accounting for the portability costs.

Written by the indexing model from the issue text.

Description

Map performance Set

I've had this thought for a while so I might as well document it and try it out at some point.

The idea is to dump the list contents into a mutable array, sort it in-place, then build a Set out of it. Mergesort (as opposed to other algorithms) would to preserve the "O(n) if already sorted" property. What I expect:

The good

  • Allocations go way down, and things get faster in most cases.

The bad

  • Might be slower on already sorted input.
  • This is GHC-only, so there will some icky bits to maintain with CPP. A bit like how we use STUArray for dfs, but more involved.
Dominant language
Haskell
Stars
356
Forks
195
Avg merge
3d 42m
Merged PRs (30d)
5

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.