这个块给
f = let (x1, x2, x3) = (\y1 -> (y1, y1), \y2 -> x1 (x1 y2), \y3 -> x2 (x2 y3))
in x1
错误:
Occurs check: cannot construct the infinite type: t1 ~ (t1, t1)
Relevant bindings include
y2 :: t1 (bound at test.hs:1:43)
x1 :: t1 -> (t1, t1) (bound at test.hs:1:10)
x2 :: t1 -> (t1, t1) (bound at test.hs:1:14)
x3 :: t1 -> (t1, t1) (bound at test.hs:1:18)
In the first argument of ‘x1’, namely ‘(x1 y2)’
In the expression: x1 (x1 y2)
我想知道let
表达式中元组类型检查背后的算法。当左侧有一个变量时,我知道 Hindley-Milney 类型检查算法。我想知道在元组/列表等情况下是否有任何特殊算法。