How can I get value from literal singleton types?

How do I get the value it corresponds to when I have a literal singleton type?

With Typelevel Scala you can use ValueOf.

scala> def foo[A: ValueOf]: A = valueOf
foo: [A](implicit evidence$1: ValueOf[A])A

scala> foo[42]
res0: Int = 42

scala> val a = 1
a: Int = 1

scala> foo[a.type]
res1: a.type = 1

With Lightbend Scala I believe you have to use something like shapeless.Witness to materialize the value.

Of course I may have misunderstood the question. If you’re in macro land I have no idea.

There is an open issue for dotty to add ValueOf