在scalaz中理解 === 行为的难度
1. scala> 1.some === Some(1)
res33: Boolean = true
2. scala> Some(1) === 1.some
<console>:14: error: value === is not a member of Some[Int]
Some(1) === 1.some
^
3. scala> (Some(1):Option[Int]) === 1.some
res35: Boolean = true
我可以理解(1),甚至期望(2)会得到相同的结果。
在(3)中,我不得不将Some转换为Option才能得到结果。
我查看了scalaz的源代码,但无法理解。
请解释一下。
Scalaz版本=7.1.0
Scala版本=2.11.2