Created
March 5, 2015 22:06
-
-
Save ceedubs/2b552b85e8b5ec86b69a to your computer and use it in GitHub Desktop.
Similar to https://gist.github.com/ceedubs/c71490e9a4376a56dc01 but without higher kinds
This file contains hidden or 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
trait Show[A] { | |
def show(a: A): String | |
} | |
object Show { | |
implicit val stringShow: Show[String] = new Show[String] { | |
def show(a: String) = a | |
} | |
} | |
trait NoImplicitFor[A] | |
sealed trait LowPriorityNoImplicitFor { | |
implicit def lowPriorityNoImplicitFor[A]: NoImplicitFor[A] = new NoImplicitFor[A] {} | |
} | |
object NoImplicitFor extends LowPriorityNoImplicitFor { | |
implicit def ambiguousPriorityNoImplicitFor1[A](implicit ev: A): NoImplicitFor[A] = new NoImplicitFor[A] {} | |
implicit def ambiguousPriorityNoImplicitFor2[A](implicit ev: A): NoImplicitFor[A] = new NoImplicitFor[A] {} | |
} | |
object Test { | |
implicitly[NoImplicitFor[Show[Int]]] | |
// doesn't compile | |
//implicitly[NoImplicitFor[Show[String]]] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment