2
bei Singleton Types Blick:Typ '1.narrow'
import shapeless._, syntax.singleton._
scala> 1.narrow
res3: Int(1) = 1
ich versucht, eine Funktion zu schreiben, die angesichts eines Singletons 1
, dh je die oben kehren ???
:
scala> def f(a: Int(1)): Unit = ???
<console>:1: error: ')' expected but '(' found.
def f(a: Int(1)): Unit = ???
^
<console>:1: error: '=' expected but ')' found.
def f(a: Int(1)): Unit = ???
^
Aber Es konnte nicht kompiliert werden.
Was ist der Typ von 1.narrow
und wie kann ich es in einer Funktion verwenden?