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

add Compare operational typeclass #79

Merged
merged 3 commits into from
Sep 20, 2021
Merged

add Compare operational typeclass #79

merged 3 commits into from
Sep 20, 2021

Conversation

palmskog
Copy link
Member

Here is an initial draft adding the Compare operational typeclass discussed in #74.

There are some low-level improvements to make, but also some questions to think about:

  • Should there be any infix notation at all for the Compare typeclass? I add here x <?> y, but I don't use it in the code, since it's such as big change.
  • I get rid of some more boolean functions for convenience. I think it looks reasonable, but there are some tradeoffs in that the Decision typeclass shows up in a lot of places.

@Casteran could you give a high-level assessment whether this PR is worth polishing up and merging? Or maybe it should stay an experiment?

@Casteran
Copy link
Member

Here is an initial draft adding the Compare operational typeclass discussed in #74.

Thanks !

There are some low-level improvements to make, but also some questions to think about:

* Should there be any infix notation at all for the Compare typeclass? I add here `x <?> y`, but I don't use it in the code, since it's such as big change.

May be we can just give the infix for a kind of compatibility with the notations in Standard Library. Personally, I will use
the synstx "compare x y" in the code.

* I get rid of some more boolean functions for convenience. I think it looks reasonable, but there are some tradeoffs in that the Decision typeclass shows up in a lot of places.

@Casteran could you give a high-level assessment whether this PR is worth polishing up and merging? Or maybe it should stay an experiment?

I have had a look at your code, and found very reasonable to get rid of the boolean function whenever possible.
We do not have sequences like unfold lt, lt_bany more :-)

The cost will be perhaps to add a documentation on Decision in the book (but it will be interesting anyway !).

@palmskog palmskog marked this pull request as ready for review September 19, 2021 21:28
@palmskog
Copy link
Member Author

I improved the organization of lemmas and did some fixes based on the discussion above. In particular, I removed the infix notation for compare for now and updated some material on the Comparable typeclass for the new (in my opinion improved) definition. I think this should now be ready to merge.

Since the Decision typeclass was not the subject of this PR, I would prefer to another PR with material in the book about Decision.

@Casteran Casteran merged commit b5e1999 into master Sep 20, 2021
@Zimmi48 Zimmi48 deleted the compare-typeclass branch September 20, 2021 07:25
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

Successfully merging this pull request may close these issues.

2 participants