This repository was archived by the owner on Sep 1, 2020. It is now read-only.
This repository was archived by the owner on Sep 1, 2020. It is now read-only.
Symbol literals should have useful singleton types #51
Closed
Description
Scala Symbols
have first class literal syntax like strings, however unlike string literals Symbol
literals lack useful singleton types,
scala> def single[T <: AnyRef](t: T): Option[t.type] = Some(t)
single: [T <: AnyRef](t: T)Option[t.type]
scala> single("foo")
res0: Option[String("foo")] = Some(foo)
scala> single('foo)
res1: Option[Symbol] = Some('foo)
shapeless simulates singleton types for Symbol
literals by @@-tagging them with the singleton type of the corresponding string literal. It would be nice, particularly in the light of #15 and #27, to have richer native singleton types for Symbol
literals too.