-
Notifications
You must be signed in to change notification settings - Fork 21
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
Type class instance can't be found for type lambda, but type alias works #6895
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6895?orig=1 |
@paulp said (edited on Dec 31, 2012 10:23:25 AM UTC): |
Erik Westra (eecolor) said: |
@retronym said: trait Foo[F1[_]]
trait Bar[F2[_]]
class Test {
def barFoo[F3[_]]: Foo[F3] = ???
// Now we can define a couple of type aliases:
type M[X1] = String
type N[X2] = Bar[M]
// val ok1: Foo[N] = barFoo
// val ok2: Foo[({type L[X] = Bar[M]})#L] = barFoo[N]
val nok: Foo[({type L[X3] = Bar[M]})#L] = barFoo /* Type inference can't unify F with L */
}
|
@retronym said: I've submitted my analysis as a test case: scala/scala#4569 |
Can cause ambiguous implicits, so is under a compiler flag -Yhk-typevar-unification. Fixes scala/bug#10197 Fixes scala/bug#10213 Fixes scala/bug#10238 Fixes scala/bug#10372 Presents an alternative fix to scala/bug#6895.
Can cause ambiguous implicits, so is under a compiler flag -Yhk-typevar-unification. Fixes scala/bug#10197 Fixes scala/bug#10213 Fixes scala/bug#10238 Fixes scala/bug#10372 Presents an alternative fix to scala/bug#6895.
Can cause ambiguous implicits, so is under a compiler flag -Yhk-typevar-unification. Fixes scala/bug#10197 Fixes scala/bug#10213 Fixes scala/bug#10238 Fixes scala/bug#10372 Presents an alternative fix to scala/bug#6895.
Can cause ambiguous implicits, so is under a compiler flag -Yhk-typevar-unification. Fixes scala/bug#10197 Fixes scala/bug#10213 Fixes scala/bug#10238 Fixes scala/bug#10372 Presents an alternative fix to scala/bug#6895.
Can cause ambiguous implicits, so is under the compiler flag -Xsource:2.13 Fixes scala/bug#10185 Fixes scala/bug#10195 Fixes scala/bug#10197 Fixes scala/bug#10213 Fixes scala/bug#10238 Fixes scala/bug#10372 Presents an alternative fix to scala/bug#6895.
Can cause ambiguous implicits, so is under the compiler flag -Xsource:2.13 Fixes scala/bug#10185 Fixes scala/bug#10195 Fixes scala/bug#10197 Fixes scala/bug#10213 Fixes scala/bug#10238 Fixes scala/bug#10372 Presents an alternative fix to scala/bug#6895.
Can cause ambiguous implicits, so is under the compiler flag -Xsource:2.13 Fixes scala/bug#10185 Fixes scala/bug#10195 Fixes scala/bug#10197 Fixes scala/bug#10213 Fixes scala/bug#10238 Fixes scala/bug#10372 Presents an alternative fix to scala/bug#6895.
Can cause ambiguous implicits, so is under the compiler flag -Xsource:2.13 Fixes scala/bug#10185 Fixes scala/bug#10195 Fixes scala/bug#10197 Fixes scala/bug#10213 Fixes scala/bug#10238 Fixes scala/bug#10372 Presents an alternative fix to scala/bug#6895.
Suppose we have the following two type classes, an instance of the first for an either-like trait, and a way of building instances of the first from some specific instances of the second:
Now we can define a couple of type aliases:
And get an instance of our first type class:
But when we try the same thing with a type lambda, we get an error:
I asked a question on Stack Overflow about this last week, but haven't gotten any answers, and I haven't been able to find any previous issues that address the problem (a comment on my question points to this open improvement, but I don't see how this could be a type constructor inference issue).
The text was updated successfully, but these errors were encountered: