Created
September 11, 2015 06:59
-
-
Save MinCha/f0ed0ef62c8b2b0a4db3 to your computer and use it in GitHub Desktop.
Scala Unary
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 abstract class AdviceGrade { | |
def unary_!(): AdviceGrade | |
} | |
case object VeryGood extends AdviceGrade { | |
override def unary_!(): AdviceGrade = Bad | |
} | |
case object Good extends AdviceGrade { | |
override def unary_!(): AdviceGrade = Good | |
} | |
case object Bad extends AdviceGrade { | |
override def unary_!(): AdviceGrade = VeryGood | |
} | |
!Bad -> VeryGood | |
!Good -> Good | |
!VeryGood -> Bad |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment