isPalindrome::(Eq a) => [a] -> Bool
isPalindrome [] = True
isPalindrome [x] = True
isPalindrome (x1:xs:x2:[])
| x1 == x2 = isPalindrome xs
|otherwise = False
[1 of 1] Compiling Main (myHas.hs, interpreted)
myHas.hs:37:27:
Couldn't match expected type `[a]' against inferred type `a1'
`a1' is a rigid type variable bound by
the type signature for `isPalindrome' at myHas.hs:33:18
In the first argument of `isPalindrome', namely `xs'
In the expression: isPalindrome xs
In the definition of `isPalindrome':
isPalindrome (x1 : xs : x2 : [])
| x1 == x2 = isPalindrome xs
| otherwise = False
Tôi là người lập trình haskell mới bắt đầu và không có đầu mối về lý do tại sao tôi nhận được lỗi này, bất kỳ trợ giúp nào?lập trình viên haskell mới bắt đầu
Hiện sự cố này đã được giải quyết chưa? – MGwynne