在模式Haskell中解析错误

时间:2013-02-13 23:41:54

标签: haskell pattern-matching operator-precedence parse-error

为什么我在此代码中出现解析错误?

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

1 个答案:

答案 0 :(得分:3)

尝试:

fun2 a (x:xs) = fun2 (fun1 a x) xs