我需要检查节点是否是我的二叉树中的叶子。这是我当前的代码。
isLeaf :: Eq a => a -> BTree a -> Bool
isLeaf node tree@(Node el left right)
| tree == Empty = False
| right == Empty && left == Empty && node == el = True
| otherwise = isLeaf node left && isLeaf node right
它向我发送一条错误消息,提示: “ hw3_71937.hs:C:\ Users \ lenovo \ Desktop \ ... \\ HASKELL \ hw3_71937.hs:(22,1)-(25,91):函数isLeaf中的非穷举模式”
我不知道如何递归检查下一个节点(如果它是叶子)。任何帮助将不胜感激。