You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add HashMapT salt, which allows creation of salt with Nat.
This allows clients to create custom salted hashmaps.
For backwards compatibility we use
```haskell
-- backwards compatibility
type HashMap = HashMapT DefaultSalt
```
Then modify the functions to be free of salt if they can, for example insert:
```haskell
insert :: forall k v salt . (Eq k, Hashable k) => k -> v -> HashMapT salt k v -> HashMapT salt k v
insert k v m = insert' (hash salt k) k v m
where
salt = natVal (Proxy :: Proxy salt)
```
This allows the default HashMap with backwards compatibility,
but also any other HashMapT
I think this solves the issue with having different salts in
an intersect:
```haskell
intersection :: (Eq k, Hashable k) => HashMapT salt k v -> HashMapT salt k w -> HashMapT salt k v
```
Because salt is the same type variable for all arguments,
it's enforced to be the same.
Then you can also provide a function to resalt if the user ever ends
up with different salts and still wants to do an intersect.
(which results in a reconstruction of the hashmap).
See thread: #319
I know these libraries will at least fail with the changes because they have instances on `HashMap`,
which now need to be `HashMapT salt`:
quickcheck-instances-0.3.25.2.drv
semirings-0.6.drv
relude-0.7.0.0.drv
semigroupoids-5.3.5.drv
I did this by stubbing out unordered containers in a 100k loc codebase
to see what issues would come up in CI.
0 commit comments