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

How about a Set equivalent? #1

Open
Herteby opened this issue Jan 30, 2019 · 5 comments
Open

How about a Set equivalent? #1

Herteby opened this issue Jan 30, 2019 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@Herteby
Copy link

Herteby commented Jan 30, 2019

Any plans on adding a corresponding Set to this package? 🙂
It could essentially just be type Set a = Set (Dict a ())

@erlandsona
Copy link

I'm not sure how to publish and 9 of the tests I copied from elm/core are failing but I'm sure there's some details with utilizing assoc-list that I just need to iron out before publishing...

What do y'all think?
https://github.com/erlandsona/assoc-set

@erlandsona
Copy link

Actually you can try it out too if you want!
@pzp1997 hope it's alright I've copy/pasted the docs for now.
https://package.elm-lang.org/packages/erlandsona/assoc-set/latest/

I've never published a library before so this was really cool!
Other than updating the docs I obviously I could just comment out the 9 failing tests too...
Curious what tips y'all have for measuring perf and such?

@pzp1997
Copy link
Owner

pzp1997 commented Feb 3, 2019

Any plans on adding a corresponding Set to this package? 🙂

Yeah, I suppose I could do this if people have a good use for it. I did not do it initially because I saw a more immediate need for a Dict substitute. I felt that the Set API was simple enough that people could make their own Set-like data structures on an ad-hoc basis. Additionally, there is already a package named Chadtech/unique-list that I thought accomplishes something pretty similar (although it doesn't exactly implement the Set API).

It could essentially just be type Set a = Set (Dict a ())

We could do it this way, but I am curious if we can get better perf by keeping the implementations of Dict and Set separate. I started working on separate implementations of the Set API earlier this week but haven't had time to run perf tests yet. (Surprisingly, elm/core actually implements Set exactly as you suggested so maybe it would be fine for us too.)

I'm not sure how to publish and 9 of the tests I copied from elm/core are failing but I'm sure there's some details with utilizing assoc-list that I just need to iron out before publishing...

I haven't had a chance to run the tests for your package yet, but if I had to take a guess the tests are failing because my package and elm/core have different invariants regarding the ordering of entries. You should modify the failing tests to account for this difference.

I've never published a library before so this was really cool!

Congrats on publishing your first library! For the sake of cohesiveness, though I would prefer to keep the Dict and Set implementations together in this library. Are you interested in working on this further and making a pull request on my repo?

Curious what tips y'all have for measuring perf and such?

I really like elm-explorations/benchmark for measuring perf.

@pzp1997 pzp1997 added the enhancement New feature or request label Feb 3, 2019
@pzp1997 pzp1997 added this to the 1.1.0 milestone Feb 3, 2019
@erlandsona
Copy link

Yeh happy to PR my fork alternatively! I just did it initially for the experience. elm packages really is wonderful!
I'll have to check out elm-explorations/benchmark! Thanks for tips!

@amitaibu
Copy link

https://github.com/Gizra/elm-all-set is based on this package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants