[Haskell-cafe] Re: Patterns overlapped?

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sun Jan 13 14:06:55 EST 2008


On Jan 13, 2008, at 14:05 , Fernando Rodriguez wrote:

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

Right.  emptyBT matches anything and stores it in a new local  
variable "emptyBT", so the second pattern overlaps this.

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH




More information about the Haskell-Cafe mailing list