我有以下功能:
union :: (Eq a) => Set1 a -> Set1 a -> Set1 a
union (MakeSet (x:xs)) (MakeSet (y:ys)) = if (member (MakeSet (y:ys)) x) && (not (isEmpty (MakeSet (x:xs))))
then union (MakeSet xs) (MakeSet (y:ys))
else if (not (member (MakeSet (y:ys)) x)) && (not (isEmpty (MakeSet (x:xs))))
then union (MakeSet xs) (insert x (MakeSet (y:ys)))
else MakeSet (y:ys)
Run Code Online (Sandbox Code Playgroud)
它编译,但当我用参数执行它时,我得到该函数具有非详尽的模式.
首先,为什么它认为我使用模式?我只使用条件语句,并且我有一个else语句,它应该捕获if then和else if语句没有捕获的所有内容.谁能告诉我这里发生了什么?