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

Alternative API using compare? #9

Open
turion opened this issue Dec 2, 2019 · 2 comments
Open

Alternative API using compare? #9

turion opened this issue Dec 2, 2019 · 2 comments

Comments

@turion
Copy link

turion commented Dec 2, 2019

I think that some parts of the code could be simplified by passing a compare function with @spec compare(data, data) :: :lt | :eq | :gt when data: var instead of order and eq.

@evnu
Copy link
Owner

evnu commented Dec 2, 2019

Would you suggest to drop :order and :eq then?

@turion
Copy link
Author

turion commented Dec 3, 2019

Yes. If order and eq are both lawful, then the information contained in compare is the same.

The only case for keeping order and eq around I can think of is non-lawful ones, e.g. when eq(x,y) does not imply order(x, y) && order(y, x). But I'd argue that such situations are confusing anyways and should be worked around in a different way (e.g. using #10 or #8).

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

No branches or pull requests

2 participants