1

I have these lines (scala 2.11.11):

trait TypeClass[T] class DoubleIsTypeClass extends TypeClass[Double] implicit val forDouble = new DoubleIsTypeClass 

Know lets add the following line :

case class User[V[_], @specialized T : TypeClass](a: V[T]) 

Now it does not compile. Removing @specialized fixes it. Is it a bug ? I don't really need higher kinds here except their help with type inference but that is a big deal.

EDIT Just for those who may have stumbled upon a similar problem

Typeclasses are not the issue here, case classes are:

case class User[V[_], @specialized T](a: V[T]) 

The line above does not compile on its own.

1
  • Provide more information on "does not compile". What's the compilation error? why do you need @specialized? Commented Jul 4, 2017 at 20:07

1 Answer 1

1

This looks like SI-9227. It seems to be a bug.

In general, these are some quirks around specialization which are worth reading about.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.