-
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
Implicit search fails to expand type alias #8286
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8286?orig=1 |
@retronym said (edited on Feb 14, 2014 3:57:19 PM UTC): This is actually just a duplicate of #2712. The type alias serves to help type constructor inference know how you want to partially apply the binary type constructor I tried to explain the behaviour recently: https://gist.github.com/puffnfresh/8540756#comment-991433 |
Robin Green (greenrd) said: |
@retronym said: It comes down to the way the Scala infers: object Test {
def foo[M[_, _]](m: M[_, _]) = 0
val x: (Option[Int], Int) = (None, 0)
foo(x)
type T[A, B] = (Option[A], B)
foo(x: T[Int, Int])
}
Type constructor inference looks at stream of dealiased- and base-types for the argument in search for one of the right kind. By introducing the alias above, it infers Workarounds are to provide implicit type class instances like You could also use type ValidationNelString[A] = ValidationNel[String, A] This has a different kind, so it will be dealised when trying to unify |
@retronym said: Haskell can do a better job here, for example, as it doesn't have subtyping, and it also mandates that partially applied type constructors can only be applied in declaration order (e.g. Tuple[Int, Int] can be considered as ([B]=>Tuple[Int, B])[Int]), but not ([A]=>Tuple[A, Int])[Int]). |
I encountered this error when using scalaz 6.0.4, and here is a self-contained test case:
The text was updated successfully, but these errors were encountered: