Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two IntMap-related improvements #390

Merged
merged 2 commits into from
Sep 26, 2023
Merged

Two IntMap-related improvements #390

merged 2 commits into from
Sep 26, 2023

Conversation

Bodigrim
Copy link
Collaborator

  • launchTestTree: use IntMap strict in values

    At the moment we use Data.IntMap which is lazy in values, and we initialise values with thunks testStatus <$> testActions. This is outright silly: testStatus is just a selector for TVar field, forcing it to WHNF can do no harm.

    We also take an opportunity to replace IntMap.fromList with IntMap.fromDistinctAscList.

  • statusMapResult: use IntSet instead of IntMap ()

    It seems the only reason behind IntMap () was the absense of Data.IntMap.withoutKeys, which was only added in containers-0.5.8.

CC @martijnbastiaan for review

It seems the only reason behind `IntMap ()` was the absense of
`Data.IntMap.withoutKeys`, which was only added in `containers-0.5.8`.
At the moment we use `Data.IntMap` which is lazy in values,
and we initialise values with thunks `testStatus <$> testActions`.
This is outright silly: `testStatus` is just a selector for `TVar`
field, forcing it to WHNF can do no harm.

We also take an opportunity to replace `IntMap.fromList` with
`IntMap.fromDistinctAscList`.
Copy link
Collaborator

@andreasabel andreasabel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to hold the changes that need a bump to containers until we drop GHC 8.0.

@Bodigrim
Copy link
Collaborator Author

@andreasabel good catch. I can put CPP of course, but I have no reason to keep compatibility with GHC < 8.6 (where 8.6 is only because of GHCJS). How do you feel about dropping earlier versions?

@andreasabel
Copy link
Collaborator

andreasabel commented Sep 26, 2023

Thinking it over, I guess it is fine to go ahead with this PR as-is.
Folks that insist on constraints: containers installed in their CI can drop GHC 8.0 from the testing phase there.
For everyone else, this bump is not a problem.

Copy link
Contributor

@martijnbastiaan martijnbastiaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally not a fan of fromDistinctAscList as it is easy to break the precondition, but given that the ascending list is right behind it this LGTM.

@Bodigrim Bodigrim merged commit 7e57b52 into master Sep 26, 2023
13 checks passed
@Bodigrim Bodigrim deleted the intmap-improvements branch September 26, 2023 23:28
@VictorCMiraldo
Copy link
Collaborator

FWIW, looks good to me too! :) Thank you for the improvements!

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.

4 participants