[Haskell-cafe] Re: Patterns overlapped?
Fernando Rodriguez
frr149 at easyjob.net
Sun Jan 13 14:05:07 EST 2008
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) = ...
More information about the Haskell-Cafe
mailing list