Skip to content

Instantly share code, notes, and snippets.

@kell18
Last active June 8, 2018 13:08
Show Gist options
  • Select an option

  • Save kell18/61c85e2e3cef48b340473f6eb8d21a84 to your computer and use it in GitHub Desktop.

Select an option

Save kell18/61c85e2e3cef48b340473f6eb8d21a84 to your computer and use it in GitHub Desktop.
trait FromSlice[C] {
def apply(v: C): Int
}
def tupleSlice[T] = new FromSlice[Tuple[T]] {
def apply(v: Tuple[T]): Int = v.size
}
// ... Same for Either and other
tupleSlice(((1, Left), (2, Right))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment