[Haskell-cafe] Re: Patterns overlapped?

Fernando Rodriguez frr149 at easyjob.net
Sun Jan 13 14:23:12 EST 2008


Hello Brandon S. Allbery KF8NH,

>> depth emptyBT = 0
>> depth (NodeBT _ left right) = max (1 + depth left) (1 + depth right)
> If you use a variable in a pattern match, it creates a new binding
> which irrefutably matches the corresponding argument.  In other
> words, you get a new local variable "emptyBT", ignoring your global.
> You must use the actual constructor instead.

I was wondering why depth always returned zero... Thanks. :-)





More information about the Haskell-Cafe mailing list