【发布时间】:2016-05-09 17:23:42
【问题描述】:
在 Idris 检查类型 if id 时,我们得到了预期的结果:
> :type id
id : a -> a
但是,检查 lambda 表达式版本会引发一个棘手的错误:
> :type \x => x
(input):Incomplete term \x => x
这是为什么?如果我使用一个函数将 x 的上下文强制转换为一个类型,我会得到我所期望的:
> :type \x => x+1
\x => x + 1 : Integer -> Integer
【问题讨论】:
-
这不只是因为 Idris 没有函数的类型推断吗?
标签: identity anonymous-function type-inference lambda-calculus idris