Skip to content

Instantly share code, notes, and snippets.

@etorreborre
Created November 26, 2014 22:55
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save etorreborre/7730aad3bd2b792f3202 to your computer and use it in GitHub Desktop.
Save etorreborre/7730aad3bd2b792f3202 to your computer and use it in GitHub Desktop.
Short implicitly form
// 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