Created
May 14, 2020 04:24
-
-
Save lu4nm3/4ef5c44053c617a780a047c33c5450ec to your computer and use it in GitHub Desktop.
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
trait DairyFree[T] { | |
def isDairyFree(item: T): Boolean | |
} | |
object DairyFree { | |
implicit val baguetteDairyFree: DairyFree[Baguette] = new DairyFree[Baguette] { | |
def isDairyFree(b: Baguette): Boolean = true | |
} | |
implicit val croissantDairyFree: DairyFree[Croissant] = new DairyFree[Croissant] { | |
def isDairyFree(c: Croissant): Boolean = false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment