[Haskell-cafe] conflicting variable definitions in pattern
slucas at dsic.upv.es
Fri May 15 04:17:49 EDT 2009
I think that the (practical) reason is avoiding equality checks during
For instance, how do you evaluate this:
foo ((+1):(1+):) ?
Both expressions in the first and second entries of the list are
but from an operational point of view, you have to ensure the equality
of two functions
over an infinite domain (of integer numbers).
Martin Hofmann escribió:
> It is pretty clear, that the following is not a valid Haskell pattern:
> foo (x:x:xs) = x:xs
> My questions is _why_ this is not allowed. IMHO, the semantics should be
> clear: The pattern is expected to succeed, iff 'x' is each time bound to
> the same term.
> Isn't this allowed, because this would require a strict evaluation of
> the 'x' variables?
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe