
13 Jan
2008
13 Jan
'08
2:05 p.m.
Hello Fernando,
Hi,
When I compile this code, ghc complains about some overlapped patterns in function depth. What on Earth is ghc talking about? O:-)
data BinTree a = EmptyTree | NodeBT a (BinTree a) (BinTree a) deriving Show emptyBT = EmptyTree depth emptyBT = 0 depth (NodeBT _ left right) = max (1 + depth left) (1 + depth right)
Sorry, the exact error is: Warning: Pattern match(es) are overlapped In the definition of `depth': depth (NodeBT _ left right) = ...