Open meooow25 opened 1 month ago
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
Uh oh.... I assume that second one extracted to a Set
?
I'm not sure what you mean. It's just a consequence of the different implementations.
Looking around at the tests we have today, we seem to be using two libraries:
ChasingBottoms
to detect bottom valuesnothunks
to detect thunksWe 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.
Strictness tests need to be in good shape to avoid bugs like #996