Last active
July 9, 2016 08:23
-
-
Save Krasnyanskiy/86f800ff5c9a807e6d5442dec83f7e6b to your computer and use it in GitHub Desktop.
-scala: interview questions
This file contains hidden or 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
sealed trait Plus[P] { | |
def ~+[T <: Plus[T]](x: T, y: T): T | |
} | |
sealed trait Int extends Plus[Int] | |
class PlusInt[PI] extends Plus[PI] { | |
def ~+[T <: Plus[T]](x: T, y: T) = x.~+(y, x) | |
} | |
case class TinyPlusInt() extends PlusInt[Int] | |
case class HugePlusInt() extends PlusInt[Int] | |
TinyPlusInt().~+(HugePlusInt(), HugePlusInt()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What's wrong with that code?