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

Enable Ord Record instance and clarify its equivalence to compiler derived Ord #176

Closed
natefaubion opened this Issue May 30, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@natefaubion
Copy link

natefaubion commented May 30, 2018

Compiler derived Ord for records is the same as RowToList ordering. I'd suggest we enable it (it's currently commented out) and note the equivalence between:

newtype MyRecord = MyRecord {...}
derive instance ordMyRecord :: Ord MyRecord
instance ordMyRecord :: Ord MyRecord where
  compare (MyRecord r1) (MyRecord r2) = compare r1 r2
@garyb

This comment has been minimized.

Copy link
Member

garyb commented May 30, 2018

I’d also be fine with this - I wasn’t really sure why the alphabetical label ordering was thought to be a problem, given that’s how derived instances work, and how generics did.

It needs documenting somewhere of course, but I don’t think it’s particularly strange - it seems “obvious“ that there would need to be some canonical ordering, given record labels are a set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment