为什么我在此代码中出现解析错误?
data One = H| I deriving (Read,Show,Eq)
data E = A | B deriving (Read,Show,Eq)
type L = [E]
fun1 :: One -> E -> One
-- function for fun1 is here
fun2 :: One -> L -> One
fun2 a [] = a
fun2 a x:xs = fun2 (fun1 a x) xs --<<< I am getting error here
答案 0 :(得分:3)
尝试:
fun2 a (x:xs) = fun2 (fun1 a x) xs