Reputation: 8281
I'm trying Literal Types from Scala 2.13 and I encounter the following error :
scala> def double[A <: Singleton] = valueOf[A]
^
error: No singleton value available for A.
Could you explain why ?
Upvotes: 1
Views: 2523
Reputation: 2851
I am not entirely sure of what you're trying, but here an example from the doc:
def foo[T](implicit v: ValueOf[T]): T = v.value
A
scala.ValueOf[T]
type class and correspondingscala.Predef.valueOf[T]
operator has been added yielding the unique value of types with a single inhabitant
Upvotes: 2