Created
April 20, 2012 08:33
-
-
Save gseitz/2427142 to your computer and use it in GitHub Desktop.
Some /== Option leads to a compiler error
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
scala> import scalaz._ | |
import scalaz._ | |
scala> import Scalaz._ | |
import Scalaz._ | |
scala> Option(17) match { | |
| case opt @ Some(_) if opt /== Option(42) => | |
| } | |
<console>:48: error: type mismatch; | |
found : Option[Int] | |
required: Some[Int] | |
case opt @ Some(_) if opt /== Option(42) => | |
^ | |
scala> Option(17) match { | |
| case opt @ Some(_) if Option(42) /== opt => | |
| } | |
scala> | |
/* | |
* if === and /== would be defined in the following manner, then the first pattern match would compile | |
* def ===[B >: A](b: B)(implicit e: Eq[B]): Boolean = e equal(a, b) | |
* | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Might be worth another look. It's a tightrope walk between permissiveness and strictness, unfortunately...