Add structural no-thunks tests for Data.HashMap.Strict (#235)#598
Draft
sjakobi wants to merge 3 commits into
Draft
Add structural no-thunks tests for Data.HashMap.Strict (#235)#598sjakobi wants to merge 3 commits into
sjakobi wants to merge 3 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.