scala – 了解类型投影
发布时间:2020-12-16 10:00:37 所属栏目:安全 来源:网络整理
导读:从 non/kind-projector开始,有什么区别: // partially-applied type named "IntOrA"type IntOrA[A] = Either[Int,A] 和 // type projection implementing the same type anonymously (without a name).({type L[A] = Either[Int,A]})#L ? 它们是等价的吗?
从
non/kind-projector开始,有什么区别:
// partially-applied type named "IntOrA" type IntOrA[A] = Either[Int,A] 和 // type projection implementing the same type anonymously (without a name). ({type L[A] = Either[Int,A]})#L ? 它们是等价的吗? 解决方法
它们几乎相同,正如评论中所说的那样.
假设你有一个类特性超级[F [_]] {},并且你想要实现它,其中F [x] = [Int,x] type IntOrA[A] = Either[Int,A] class B extends Super[IntOrA] {} 但如果你想要一个班轮,你可以写: class B extends Super[({type L[A] = Either[Int,A]})#L] {} 或者使用亲切的投影仪,你可以写它: class B extends Super[λ(A => Either[Int,A])] {} 甚至: class B extends Super[Either[Int,?]] {} 除了使它成为一行并且具有这种类型的匿名之外没有其他区别. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- AngularJS – 可拖动和多个连接的可排序(jQuery UI angular
- 如何在vim或emacs等编辑器中打开Web浏览器(如Firefox)中的文
- twitter-bootstrap – Twitter Bootstrap PopOver仅适用于第
- scala – 以干式方式扩展SLICK表
- Docker compose给我已经分配了吗?
- adb shell命令使Android包卸载对话框出现
- Webservice 接口
- gsoap生成webservice调用客户端接口 .
- scala – sbt – 对象apache不是包org的成员
- angular – 将输入值传递给Dialog Component