Created
November 26, 2014 22:55
-
-
Save etorreborre/7730aad3bd2b792f3202 to your computer and use it in GitHub Desktop.
Short implicitly form
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
// for a given typeclass | |
trait CharIso[T] { | |
def toChar(t: T): Char | |
def fromChar(c: Char): T | |
} | |
// provide the following apply method | |
// so that you can write: CharIso[T].toChar(...) instead of implicitly[CharIso[T]].toChar(...) | |
object CharIso { | |
def apply[T : CharIso]: CharIso[T] = implicitly[CharIso[T]] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment