考虑以下代码:
step :: [[a] -> [a]] -> [[a]] -> [[a]]
step (f:fs) xss
| (fs == []) = yss
| otherwise = step fs yss
where yss = map f xss
Run Code Online (Sandbox Code Playgroud)
它引发以下错误:
No instance for (Eq ([a] -> [a])) arising from a use of ‘==’
(maybe you haven't applied a function to enough arguments?)
|
3 | | (fs == []) = res
| ^^^^^^^^
Run Code Online (Sandbox Code Playgroud)
fs 应该是一个函数列表或一个空列表,那么为什么编译器试图用它来制作一个函数呢?