Skip to content

Instantly share code, notes, and snippets.

@puffnfresh
Last active February 27, 2016 12:40
Show Gist options
  • Save puffnfresh/dd9b9ebb033ef5573721 to your computer and use it in GitHub Desktop.
Save puffnfresh/dd9b9ebb033ef5573721 to your computer and use it in GitHub Desktop.
sealed trait Caster[A, B]
case object CastTo extends Caster[Unit, Unit]
case class Ignored[A, B]() extends Caster[A, B]
def cast[A, B]: A =:= B =
(Ignored(): Caster[A, B]) match {
case CastTo | _ => implicitly[B =:= Unit]
}
cast[String, Int]: String =:= Int
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment