Skip to content

Instantly share code, notes, and snippets.

@gseitz
Created April 20, 2012 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gseitz/2427142 to your computer and use it in GitHub Desktop.
Save gseitz/2427142 to your computer and use it in GitHub Desktop.
Some /== Option leads to a compiler error
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)
*
*/
@retronym
Copy link

Might be worth another look. It's a tightrope walk between permissiveness and strictness, unfortunately...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment