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

Scala compiler does not compile when looking for an implicit structure type for a higher kinded type parameter #9451

Closed
scabug opened this issue Aug 30, 2015 · 4 comments

Comments

@scabug
Copy link

scabug commented Aug 30, 2015

Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
Type in expressions to have them evaluated.
Type :help for more information.

scala> implicit def impl[I[_]]:{type F[X] = { type Self = I[X] }} = new {type F[X] = { type Self = I[X] }}
warning: there was one feature warning; re-run with -feature for details
impl: [I[_]]=> AnyRef{type F[X] = AnyRef{type Self = I[X]}}

scala> implicitly[{type F[X] = { type Self = Iterable[X] }}]
<console>:12: error: could not find implicit value for parameter e: AnyRef{type F[X] = AnyRef{type Self = Iterable[X]}}
       implicitly[{type F[X] = { type Self = Iterable[X] }}]
                 ^
@scabug
Copy link
Author

scabug commented Aug 30, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9451?orig=1
Reporter: @Atry

@scabug
Copy link
Author

scabug commented Aug 30, 2015

@retronym said:
Boiling this down a little:

scala> implicitly[{type F[X] = { type Self = Iterable[X] }}](impl)
<console>:9: error: kinds of the type arguments (Iterable[X]) do not conform to the expected kinds of the type parameters (type I).
Iterable[X]'s type parameters do not match type I's expected parameters:
type Iterable has one type parameter, but type I has one
              implicitly[{type F[X] = { type Self = Iterable[X] }}](impl)
                                                                    ^
scala> impl : {type F[X] = { type Self = Iterable[X] }}
<console>:9: error: kinds of the type arguments (Iterable[X]) do not conform to the expected kinds of the type parameters (type I).
Iterable[X]'s type parameters do not match type I's expected parameters:
type Iterable has one type parameter, but type I has one
              impl : {type F[X] = { type Self = Iterable[X] }}
              ^

scala> impl[Iterable] : {type F[X] = { type Self = Iterable[X] }}
scala.NotImplementedError: an implementation is missing
  at scala.Predef$.$qmark$qmark$qmark(Predef.scala:225)

@scabug
Copy link
Author

scabug commented Aug 30, 2015

@Atry said:
I found this issue when I was trying to create a type class for a scalaz's tagged type https://github.com/scalaz/scalaz/blob/v7.1.3/core/src/main/scala/scalaz/Tag.scala

@diesalbla
Copy link

This is not solved in Scala 2.12.8, but it is solved in the current Scala 2.13.x branch, and Dotty as well.

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

No branches or pull requests

3 participants