Re: Lazy Patterns (was: Curry module system and other proposals)

From: Michael Hanus <>
Date: Fri, 03 Mar 2006 11:28:36 +0100

Wolfgang Lux wrote:
> I'm sorry, but I still don't get your point. After all f's pattern
> is ~p and not p. These are quite distinct patterns. I would neither
> expect that (Just x) and x are the same patterns or could be applied
> to the same set of expressions.

I had the formal notion of "pattern" in mind so that p is a pattern
in the formal sense but ~p is not a pattern in the formal sense
but just syntactic sugar for a let/where declaration and/or
a couple of auxiliary functions implementing lazy pattern
matching by means of projection functions. Therefore,
I see this "tremendous" difference between p and ~p:
the former is directly reflected in the term rewriting
model of functional (logic) programming, whereas the latter
has no direct correspondence (but only a correspondence via
some syntactic transformation).

> I don't think this is intended for ghc (Hugs does not appear to emit
> warnings anyway). Ghc -Wall will emit a warning for the definition
> stupid _ = False
> stupid False = True
> so I think it is rather a bug that it doesn't emit a warning when a
> lazy pattern is used in the first equation.

Ok, thanks for the clarification. I would prefer to provide
such warnings also without specific options, because
they are in particular important for non-experts who
usually don't use specific options.

> Anyway, I think I have proved Wadler's law now long enough
> once again and to put an end to this discussion, I withdraw my
> proposal to include lazy patterns in Curry.

Right, Wadler's laws are always present...



curry mailing list
Received on Fr Mär 03 2006 - 11:31:29 CET

This archive was generated by hypermail 2.3.0 : Fr Jul 10 2020 - 07:15:03 CEST