【发布时间】:2014-05-06 17:11:34
【问题描述】:
我试图理解为什么这两个评估:(init . cuts) [1,2,3] 和 init . cuts [1,2,3] 不同,其中:
cuts :: [a] -> [([a],[a])]
cuts xs = zipWith splitAt [0..length xs] (repeat xs)
第一个给出了我期望的结果:[([],[1,2,3]),([1],[2,3]),([1,2],[3])] ,但第二个返回此错误:
<interactive>:389:8:
Couldn't match expected type `a0 -> [a1]'
with actual type `[([a2], [a2])]'
In the return type of a call of `cuts'
Probable cause: `cuts' is applied to too many arguments
In the second argument of `(.)', namely `cuts [1, 2, 3]'
In the expression: init . cuts [1, 2, 3]
我假设init . cuts [1,2,3] = init (cuts[1,2,3]),这是正确的吗?
谢谢,
塞巴斯蒂安。
【问题讨论】:
标签: haskell types unification