scala - 为什么 Scala 中的高阶统一被认为是部分的?

标签 scala type-inference terminology type-constructor

SI-2712 Add support for partial unification of type constructors #5102最初提供了标记下的功能

-Yhigher-order-unification

但随后将其重命名为

-Ypartial-unification

因为它似乎不是完全高阶统一

comment

"partial type application inference" is probably a better term for what's happening here than "higher-order unification", which this most certainly is not

comment 2

rename it to -Ypartial-unification to reflect that fact it doesn't implement a general HOU algorithm.

部分统一与高阶统一有何不同? Scala 在什么意义上没有实现高阶统一?当 Scala 无法执行 HOU 时,您能用具体的代码片段进行演示吗?

最佳答案

总的来说,如果“缺失”类型是最右边的类型,Scala 实现只会执行高阶统一。

Daniel Spiewak使用基本为 Either 的类型的仿函数实例演示了这一点,但存在偏向。

关于scala - 为什么 Scala 中的高阶统一被认为是部分的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68150413/

相关文章:

scala - 将多个选项转换为列表的惯用方式

typescript - 是否可以修改 TypeScript 中文字的推断类型?

haskell - Control.Lens 中的 Market 这个名称背后的原因是什么?

typescript - 为什么 typescript 枚举无助于推断联合类型

terminology - 网页设计师、网页开发人员和网页程序员之间的区别

python - 抽象在编程中意味着什么?

scala - Playframework - Request[A] 与 RequestHeader

scala - 将 Scala Anorm 记录转换为特定对象

javascript - 使用 scala.html 时在括号内添加参数值

c# - 为什么 C# 编译器不认为这种泛型类型推断有歧义?