At 09:15 97-04-28, Simon L Peyton Jones wrote:
>A proposal
>~~~~~~~~~~~
>The proposal I want to make is simple:
>
> Instead of being a boolean expression,
> a guard is a list of qualifiers,
> exactly as in a list comprehension.
>
> That is, the only syntax change is to replace
> "exp" by "quals" in the syntax of guarded equations.
>
>Here is how I would write clunky:
>
> clunky env var1 var1 | Just val1 <- lookup env var1,
> Just val2 <- lookup env var2
> = val1 + val2
> ...other equations for clunky...
Are you not just asking for another equivalence relation, "patterns
match"? Call it, say, "==="; then you could write
clunky env var1 var1 | Just val1 === lookup env var1 &&
Just val2 === lookup env var2
= val1 + val2
...other equations for clunky...
but also combine with other Boolean expressions.
Hans Aberg