-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add Enum Eq #2552
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 Enum Eq #2552
Conversation
// : Eq[C[T1$1, ..., Tn$1], C[T1$2, ..., Tn$2]] = Eq | ||
def eqInstance = { | ||
def append(tdef: TypeDef, str: String) = cpy.TypeDef(tdef)(name = tdef.name ++ str) | ||
val leftParams = derivedTparams.map(append(_, "$1")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to not use semantic names here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we could do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand, maybe it's not worth the hassle. The names literally don't matter.
Need reflexive instances so that eqAny does not kick in.
If all you do with `y` is compare it to other values of type `T`, the program will | ||
typecheck but probably give unexpected results. | ||
|
||
Multiversal equaliy is an opt-in way to make universal equality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: equality
The `dotty.DottyPredef` object defines a number of `Eq` | ||
implicits. `dotty.DottyPredef` is a temporary `Predef`-like object. | ||
The contents of this object are by default imported into every | ||
program. Once dotty becomes standard Scala, `DottyPredef` will go away |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the standard spelling of Dotty? "dotty", "Dotty", context-dependent? When does one capitalize?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's settle on capitalizing it
--- | ||
layout: doc-page | ||
title: "Named Type Arguments" | ||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would also be great to have a page about implicit function types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coming up...
@senia-psm Fixing it, thanks! |
Needed to pass multiversal equality rules.
Add an Eq instance to every Enum so that they can be compared only to other values of the same type.