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
object CompanionConstraint { | |
// prerequisites | |
type UpperBound[T] = T // for now; needs to be type macro ... | |
trait Companion[T <: { type Object }] { this: UpperBound[T#Object] => implicit def self = this } | |
def companion[T <: { type Object } : Companion]: UpperBound[T#Object] = implicitly[Companion[T]].self | |
// declarations |
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
// package ... | |
import java.io._ | |
object ListSer { | |
sealed abstract class List[+A] extends Serializable { | |
def isEmpty: Boolean | |
def head: A | |
def tail: List[A] |