我有正常工作的功能:爲什麼我在這個Haskell代碼中找不到預期的類型?
z::Int->Int->[Char]
z x y =show(x)++show(y)++show(x*y)
這真的只是將一些數字成字符串的函數。 然後我用快速排序功能快速排列字符串。
quicksort.z 2 3
但在這裏我得到的錯誤
Couldn't match expected type `a0 -> [a1]' with actual type `[Char]'
In the return type of a call of `z'
In the second argument of `(.)', namely `z 2 3'
In the expression: flagskib . z 2 3
我試着像括號和使用$的功能,但沒有幫助修復。
我欣賞它上面的任何單詞。這個問題已經解決了,所以這篇文章的全部意義是要學習。