This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class FunnyPair[A,B](a:A, b:B) | |
val x = FunnyPair // apparently it's equivalent to: type x = FunnyPair.type | |
x(2,"9") | |
scala> case class FunnyPair[A,B](a:A, b:B) | |
defined class FunnyPair | |
scala> val x = FunnyPair | |
x: FunnyPair.type = FunnyPair |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class FunnyPair[A,B](a:A, b:B) | |
type ::[A,B] = FunnyPair[A, B] | |
def add(x: Int :: Int) = x.a + x.b | |
scala> case class FunnyPair[A,B](a:A, b:B) | |
defined class FunnyPair | |
scala> type ::[A,B] = FunnyPair[A, B] | |
defined type alias $colon$colon |
NewerOlder