[英]Evidence that there's no evidence
Is there a Not[Ev]
type, or a way to implement it, that I can use in the following way是否有Not[Ev]
类型或实现它的方法,我可以通过以下方式使用
def someMethod[X,Y](implicit ev:Not[X <:< Option[Y])= ???
Meaning the type X is not an Option[_] type?意思是类型 X 不是 Option[_] 类型? (and more could be done with that) (而且可以做更多的事情)
Docs of implicitAmbiguous
suggest the following implementation of type inequality implicitAmbiguous
歧义的文档建议以下类型不等式的实现
trait =!=[C, D]
implicit def neq[E, F] : E =!= F = null
@annotation.implicitAmbiguous("Could not prove ${J} =!= ${J}")
implicit def neqAmbig1[G, H, J] : J =!= J = null
implicit def neqAmbig2[I] : I =!= I = null
where在哪里
def someMethod[X,Y](implicit ev: X =!= Option[Y])= ???
someMethod[Int, String] // ok
someMethod[Option[Int], Int] // error
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.