Skip to content

Add structural no-thunks tests for Data.HashMap.Strict (#235)#598

Draft
sjakobi wants to merge 3 commits into
masterfrom
sjakobi/issue235-nothunks-tests
Draft

Add structural no-thunks tests for Data.HashMap.Strict (#235)#598
sjakobi wants to merge 3 commits into
masterfrom
sjakobi/issue235-nothunks-tests

Conversation

@sjakobi

@sjakobi sjakobi commented Jul 12, 2026

Copy link
Copy Markdown
Member

No description provided.

sjakobi added 3 commits July 10, 2026 23:20
Adds a manual NoThunks instance for HashMap/Leaf/HashSet that traverses
the internal tree, unlike the existing Foldable-based checks in
Regressions.hs which only see values and would never have caught #232.
Includes a direct regression test for #232 and a QuickCheck suite
exercising the internal-strictness invariant across most
Data.HashMap.Strict operations.

Assisted-by: Claude Sonnet 5
The structural no-thunks tests flagged mapKeys: with colliding keys, the
result's Collision array contained a thunk in place of a Leaf. Since L's
key field is strict, GHC's STG tag inference lowers the Leaf allocation
in updateOrSnocWithKey to a defensive thunk when the key's taggedness is
statically unknown, which is the case in unspecialized code. All other
operations avoid this because their INLINABLE chains specialize at the
caller's key type; mapKeys lacked the pragma, so its internal fromList
always ran the generic code.

Assisted-by: Claude Fable 5
Prelude only re-exports foldl' since base 4.20 (GHC 9.10).

Assisted-by: Claude Sonnet 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant