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) = ...



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to