Skip to content

Instantly share code, notes, and snippets.

@quii
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quii/10529675 to your computer and use it in GitHub Desktop.
Save quii/10529675 to your computer and use it in GitHub Desktop.
// [A: Serialiser] means the compiler expects an implicit Serialiser
// needs to be available for A
def writeJsonToDisk[A: Serialiser](item: A){
def writeToDisk(x:String){println(s"I saved [$x] to disk, honest!")}
// Access the parameter with implicity
writeToDisk(implicitly[Serialiser[A]].toJson(item))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment