-
Notifications
You must be signed in to change notification settings - Fork 99
Arbitrary instance for HashMap is unfortunate #154
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
Comments
I looked into trying to improve this myself. Unfortunately, doing so requires a clear understanding of the data structural invariants, which don't seem to be specified in the source. |
It's a bit tricky to create valid structures without going via the public API, you essentially have to mirror what insertion does. |
Is repeated insertion sufficient to achieve all possible trees, or is
deletion necessary too? For instance, if I insert two keys that collide,
and then delete the first, will I get the same tree as if I'd only inserted
the second?
…On Jun 12, 2017 10:02 PM, "Johan Tibell" ***@***.***> wrote:
It's a bit tricky to create valid structures without going via the public
API, you essentially have to mirror what insertion does.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#154 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABzi_a8PtgfNvtzbugcBZI2B3zrYy0t1ks5sDdkJgaJpZM4N2qFH>
.
|
We should probably not assume that only insertions get you all trees, because there's an implementation option to either collapse unnecessarily deep branches eagerly or lazily on deletion. |
I just now noticed the work in #157. @treeowl In #157 (comment) you said
Could you expand a bit on this? Which changes does this refer to? Which redundancy was removed? Do these changes mean that this issue was already fixed? |
It used to be that certain paths weren't compressed under some circumstances. I don't remember the circumstances. So there could have been multiple tree shapes representing the same map. That meant maps could sometimes get inefficient, and it made the |
Since HashMaps have been canonicalized I think we can close this issue now. |
arbitrary
forHashMap k v
(intests/Strictness.hs
) is based onfromList
. This means that onlyHashMap
shapes that can be produced byfromList
will be represented in the inputs to test functions.The text was updated successfully, but these errors were encountered: