Having this code:
object Types {
val undefined = "undefined".narrow
type RunnableArgument = BigDecimal :+: String :+: Boolean :+: CNil
}
I would like to have the type of the undefined
constant as one of the RunnableArgument
hlist elements. Is it even possible?
Singleton types used as HList values in scala 2.13, check the original SIP:
https://docs.scala-lang.org/sips/42.type.html
So, in your case, you can write:
RunnableArgument = "undefined" :+: String :+: Boolean :+: CNil
Also you can use this thing as type:
type Param = "singleton type"
This compiles in scastie: