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

Improve strictness tests #1019

Closed
meooow25 opened this issue Aug 8, 2024 · 4 comments
Closed

Improve strictness tests #1019

meooow25 opened this issue Aug 8, 2024 · 4 comments

Comments

@meooow25
Copy link
Contributor

meooow25 commented Aug 8, 2024

Strictness tests need to be in good shape to avoid bugs like #996

@meooow25
Copy link
Contributor Author

meooow25 commented Aug 10, 2024

Just started and I'm seeing things like

λ> import qualified Data.Map.Strict as M
λ> M.fromList [(1,undefined),(1,2)]
fromList *** Exception: Prelude.undefined
λ> M.fromAscList [(1,undefined),(1,2)]
fromList [(1,2)]

Hope there aren't too many of these...

Edit: To clarify, this is not a bug. Both do not allow bottom into the map. It's just inconsistent.

Edit: Turns out this is a known issue #473

@treeowl
Copy link
Contributor

treeowl commented Aug 10, 2024

Uh oh.... I assume that second one extracted to a Set?

@meooow25
Copy link
Contributor Author

I'm not sure what you mean. It's just a consequence of the different implementations.

@meooow25
Copy link
Contributor Author

Looking around at the tests we have today, we seem to be using two libraries:

  • ChasingBottoms to detect bottom values
  • nothunks to detect thunks

We can test strictness by detecting bottoms, but the nothunks machinery seems massively more powerful than what we need. nothunks is intended to find thunks in nested data by exploring it in the manner of NFData. We don't have such nested data in containers, it's just about whether maps contain bottom values or whether strict folds indeed fold strictly. I think we could remove this dependency if we wanted.

We can perhaps even inline the bits of ChasingBottoms we use and remove that too. But I'll leave that for later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants