Comments (8)
for a given set of elements, the IntSet representation is unique? E.g., "the mask is the largest position ..." https://github.com/haskell/containers/blob/master/containers/src/Data/IntSet/Internal.hs#L261
Then a hash function could just use structure and contents of the internal representation generically?
from containers.
@jwaldmann Correct.
from containers.
Correct, but it would be wasteful. The Tip
s contain all the elements, it would be sufficient to just hash the contents of those (ignoring Bin
s).
from containers.
Correct, but it would be wasteful. The
Tip
s contain all the elements, it would be sufficient to just hash the contents of those (ignoringBin
s).
Oh yeah, I think there is redundant info there. I'd have to review the representation; it's been a little while.
from containers.
Ah yes, the Tip includes the prefix.
from containers.
We could offer
serialize :: (Word -> r -> r) -> r -> IntSet -> r
This could be used to hash efficiently, with serialize
written so it can inline. What would be a good matching deserialize
type though?
from containers.
- serialize: could we write
instance Ord IntSet
with that? (#787 #470) - deserialize: don't know. what would be the use case?
from containers.
I doubt that's quite what we'd want for Ord
, but maybe close. The use case is that I'd be more comfortable with "publicly" exporting serialize/deserialize than a function that's only good for writing the Hashable
instance.
from containers.
Related Issues (20)
- Different Links to OverloadedLists Extension HOT 1
- A more efficient Graph representation HOT 4
- Use generic map merging framework HOT 1
- Build fails with "Prelude.chr: bad argument" HOT 11
- Build of container-test fails with cabal HOT 8
- containers-0.6.4.1 and 0.6.3.1 fail to build with GHC-9.6.1 HOT 2
- Set difference and union in one HOT 4
- foldTree does not optimize well HOT 2
- Tree fusion HOT 16
- Fusible Set.fromDistinctAscList definition HOT 10
- Fusible IntSet.fromDistinctAscList definition HOT 3
- NonEmpty for CyclicSCC HOT 11
- Unusual definition of foldrBits and foldlBits HOT 3
- Unnecessary CPP and C header in `Data.Map.Internal.Debug.html`?
- Release for GHC 9.8.1 HOT 17
- feat request: Add `popLeftWithValue` and `popWithValue` in `Data.Sequence` HOT 5
- Data.Graph: detect cycles utility functions HOT 2
- Data.Map.mergeWithKey doesn't match documentation
- Flag to introduce pedantic invariant checks? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from containers.