Last active
February 27, 2016 12:40
-
-
Save puffnfresh/dd9b9ebb033ef5573721 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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