Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的问题与“定点组合器”有关。根据this Wikipedia page section的功能fix,
fix
fix f = f (fix f)
是类型(或至少可以是类型)
(a -> a) -> a
有人可以解释我为什么吗?
从定义开始
因为它需要一个参数,所以fix必须有一个看起来像的类型
fix :: x -> y
它将它的论点应用于某事,所以事实上
fix :: (p -> q) -> r
它实际上将它的论点应用于fix f,所以
fix f
fix :: (r -> q) -> r
最终的结果其实就是这个应用的结果,所以
fix :: (r -> r) -> r