-
Notifications
You must be signed in to change notification settings - Fork 0
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
Naming and documentation #1
Comments
Hi, could you please clarify what point (3) means? I'm having some trouble understanding. Regarding (1), (2), and (4), I'm unfortunately not inclined to perform any of these name-changes to satisfy the stated criteria. Thank you for the suggestions. |
For certain data types in the language multiple representations are possible:
Amortized queues (what this package calls "ephemeral") can be implemented either way:
Whether or not one would want to use either of these is not a question of performance, the trade-offs are instead:
For the record I rewrote this package to have both of these variants, plus spine-strict real-time deques, so if you're on board with upgrading this package to |
Ok. I'm afraid I may have to see some code in order to fully grasp what changes you are proposing we make here. For now I will say regarding this point:
The "ephemeral" queue provided in this package achieves its stated amortized bounds only under ephemeral usage. That is why it is named such. This is distinct from, say, the Banker's queue, which achieves its stated amortized bounds even under persistent usage. The reason this package only provides an ephemeral "dumb" / "naive" two-list queue and a real-time queue, but not an amortized Banker's queue, is that in my benchmarks the amortized Banker's queue does not out-perform the real-time queue. The trade-off presented here, then, is between fast Hope that helps, thanks! |
Queues are data structures, so I would expect the modules to be called
Data.Queue
andData.Queue.Ephemeral
respectively;EphemeralQueue
is an extremely unwieldy name. Calling all queuesQueue
and providing a type synonym for each (RealTimeQueue
for the other one) would be more convenient;Documentation should describe how each queue type operates instead of making "when it doubt" statements.
Notably:
There aren't all that many data structures implemented in Haskell and pretty much all commonly used ones are spine-strict. Pure queues are inevitably spine-lazy, so we should be able to talk in terms of amortized time complexity instead. I tried to do that with e.g. lazy PATRICIA trees, it'd be nice to share notation across the ecosystem.
I wonder if
enqueueFront
/enqueue
/dequeue
should be calledcons
/snoc
/uncons
instead. Datatype function definitions are generally expected to clash withData.List
anyway, that's why all such modules are imported qualified.The text was updated successfully, but these errors were encountered: