Skip to content

Instantly share code, notes, and snippets.

@yilinwei
Created May 7, 2020 19:17
Show Gist options
  • Save yilinwei/7f092ee60b798fee75fe18e2535f0a4d to your computer and use it in GitHub Desktop.
Save yilinwei/7f092ee60b798fee75fe18e2535f0a4d to your computer and use it in GitHub Desktop.
object Example {
def failsHorribly[T1 <: Tuple, T2 <: Tuple](f: () => Either[Unit, Tuple.Concat[T1, T2]])(using size: Tuple.Size[T1]): () => Either[Unit, T2] = {
() => {
f() match {
case Left(_) => Left(())
case Right(item) => Right(item.drop(size).asInstanceOf[T2])
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment