(Pattern) Guards in lambdas

Claus Reinke claus.reinke at talk21.com
Tue Oct 17 10:48:50 EDT 2006


since Pattern Guards appear to be popular with the committee,
I suggest to revisit the decision to drop guards from lambdas:

(a) http://www.cse.unsw.edu.au/~dons/haskell-1990-2000/msg00353.html
(b) http://www.cse.unsw.edu.au/~dons/haskell-1990-2000/msg00382.html

1. I disagree that this was a simplification of Haskell

    the language became smaller (fewer valid programs), but
    that reduction in size was bought by breaking a symmetry
    (pattern matches are the same whereever they are used)
    and adding a restriction (no guards for patterns in lambdas),
    so the smaller language is actually more complicated.

2. adding guards to lambdas can only cause more program
    runs to fail (no chance of handling pattern-match/guard
    failure and fall through), so it is kind of understandable 
    that this feature was considered dubious. however,

    - adding a guard there is comparable to adding an
        assertion, a feature often considered valuable
    
    - with pattern guards, the guard is no longer restricted
        to filtering, and that added functionality is not
        currently accessible for lambda patterns

suggestion: undo removal of guards from lambdas, especially
(but not only) if pattern guards make it into the language.

claus

ps. are there any notes regarding the discussion and
        stylistic grounds mentioned in (a)?



More information about the Haskell-prime mailing list