[Haskell] IN Doubt...
Don Stewart
dons at galois.com
Tue Oct 16 17:52:50 EDT 2007
hg.manuel:
> Dear Haskellers,
>
> why this program is not accepted by Hugs?
>
> equal a a = True
> equal a b | not(a==b) = False
You can't pattern match 'a' and 'a' like that -- there's no implicit
unification.
Instead, I'd write:
equal a b
| a == b = True
| otherwise = False
Well actually, maybe I'd write:
equal a b = a == b
In reality, though:
equal = (==)
And then I'd just use (==) directly :)
Cheers,
Don
More information about the Haskell
mailing list