我正在从Haskellwiki(99个问题)进行练习,我得到了#34; exercize.hs:1:12:解析错误输入' - >'":
myLast [a] -> a
myLast [] = error "Empty list has no last element"
myLast [x] = x
myLast (_:xs) = myLast xs
我在Win8.1上使用Notepad ++,编译器是GHCi。我重写了很多次,我看不出错。为什么会这样?
答案 0 :(得分:1)
您忘记了::
myLast :: [a] -> a