Created
October 19, 2016 20:59
-
-
Save kevinmeredith/b7b1a730a1a4c1c5ee94ceb1b4c64150 to your computer and use it in GitHub Desktop.
DoorStatus ADT - using String's without `write`
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 DoorStatus | |
| case object Open extends DoorStatus | |
| case object Closed extends DoorStatus | |
| object DoorStatus { | |
| val OpenShowValue = "open" | |
| val ClosedShowValue = "closed" | |
| def show(d: DoorStatus): String = d match { | |
| case Open => OpenShowValue | |
| case Closed => "ClosedShowValue | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment