Skip to content

Instantly share code, notes, and snippets.

@dwins
Created December 4, 2012 19:41
Show Gist options
  • Save dwins/4207894 to your computer and use it in GitHub Desktop.
Save dwins/4207894 to your computer and use it in GitHub Desktop.
def fetch[R : Fetchable](s: SQLCursor): R = implicitly[Fetchable[R]].fetch(s)
trait Fetchable[R] {
def fetch(s: SQLCursor): R
}
implicit object IntIsFetchable extends Fetchable[Int] {
def fetch(s: SQLCursor): Int = s.getInt
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment