nikita-volkov / stm-containers

Containers for STM
http://hackage.haskell.org/package/stm-containers
MIT License
66 stars 13 forks source link

[RFC] Add STMContainers.Multiset #13

Open sjakobi opened 8 years ago

sjakobi commented 8 years ago

I have implemented a simple multiset on top of Map that is useful for counting things. The API is partly inspired by the multiset package.

I'm still unsure about the following design issue:

Should the counts be represented as Word, Word64 or Natural instead?

This would simplify focus, insertMany and deleteMany, and allow for larger counts.

On the downside Word and Word64 are slightly more hairy to use safely and Natural would result in higher memory consumption.

nikita-volkov commented 8 years ago

Thanks for your contribution, however I believe it would be better for you to release this as your own separate package. Since in your implementation you only depend on the public parts of the API this should pose no problems for you.

I've actually been thinking about revising the library to extract all the others containers as separate packages. If you're interested in the reasons, I've described a few in a documentation for another package. I plan to make an expanded post about the benefits of such an approach some time soon.

sjakobi commented 8 years ago

Thanks for the quick response!

I think you're making some pretty good points in that README. On the other hand it's only a few days ago that I heard other people favoring fewer, more fully-featured packages. I think the main argument was less maintenance hassle for both authors and users.

Would you mind if I leave this PR open until the discussion on your post is over? I'd be very interested in hearing other opinions on this policy.

nikita-volkov commented 8 years ago

Sure. I'll try to remember to post a link here when I publish it.

sjakobi commented 8 years ago

Sure.

Thanks!

I'll try to remember to post a link here when I publish it.

No worries! I'm sure I'll see it on r/haskell! :)

3noch commented 7 years ago

@nikita-volkov Did you ever write that post? ;)

3noch commented 7 years ago

@sjakobi What ever became of this? Did you release your work as a separate package?

sjakobi commented 7 years ago

Did you release your work as a separate package?

I haven't so far. If you'd like to use it, I will though! Do you have a comment on the design issue from above?

Should the counts be represented as Word, Word64 or Natural instead?

nikita-volkov commented 7 years ago

@3noch Not yet

mitchellwrosen commented 5 years ago

I'd just like to chime in on the separate package debate. The major problem I see with releasing a package like stm-containers-multiset is discoverability.

Ideallly, there could be a prominent section in stm-containers' description that says, like, "Check out these similar packages, none of which are officially endorsed by this author". Then, even crappy packages/variations can at least get enough eyes on them for collaboration, bug fixes, rewrites, or what have you. It'd just be a shame if multiple people implement stm-containers-multiset just because they don't know about each others' work, and the Hackage UI really does not help us out here.

@nikita-volkov What do you think about that? Would you be willing to, say, point at other peoples' packages in the stm-containers description, for situations like this? (If not, totally fine of course, just wondering).

mitchellwrosen commented 5 years ago

@sjakobi Natural :)

(Similar situation solved in stm with Natural: https://hackage.haskell.org/package/stm-2.5.0.0/docs/Control-Concurrent-STM-TBQueue.html)

nikita-volkov commented 5 years ago

Would you be willing to, say, point at other peoples' packages in the stm-containers description, for situations like this?

Sure! No problem