Re: pattern guards and guarded patterns

1997-05-02 Thread Guillermo Calderon
I think Herbert's monadic version of "clunky" is really satisfactory : >clunky env var1 var2 = fromJust (do val1 <- lookup var1 env > val2 <- lookup var2 env > return (var1 + var2) > ++ >

Re: pattern guards and guarded patterns

1997-05-01 Thread Pablo E. Martinez Lopez
Errata: in my previous mail, the text "a la Hoare" should be replaced by "a la Dijkstra". Fidel.

Re: pattern guards and guarded patterns

1997-05-01 Thread Brian Boutel
> 3. I think it's quite important to use "<-" rather than "=". > a) it means that the syntax is precisely that of list comprehensions > b) there's an "=" in the definition already, as Andy points out: > simplify (Plus e e') | let (Val 0) = s = s' >

Re: pattern guards and guarded patterns

1997-04-30 Thread Alex Ferguson
A couple of minor counter-quibbles:- Pablo E. Martinez Lopez suggests: > You can define your own "sequential if" a la Hoare: > >data GuardedExp a = Bool :? a > >seqif :: [GuardedExp a] -> a >seqif [True:?a] = a >seqif ((b:?a):x:xs) = if b then a else seqif (x:xs

pattern guards and guarded patterns

1997-04-30 Thread Tommy Thorn
I can see the arguments for the pattern guard extension and the syntax seem reasonable. I also agree with Chris on the shortcomings of if-then-else. (I have disliked it in any language where I've seen it, and it "feels" un-Haskell-like to me.) On the other hand, the suggested case | ..

Re: pattern guards and guarded patterns

1997-04-30 Thread Pablo E. Martinez Lopez
>I have longstanding dislike of Haskell's expression conditional: > The problem comes when several conditions are > present, provoking a rightward march. In this case I use > > if test1 then > part1 > else if test2 then >

Re: pattern guards and guarded patterns

1997-04-30 Thread Philip Wadler
Tommy Thorn writes: > My only worry is that Haskell (if not already) is turning into the C++ > of functional languages, ie. feature upon feature. Haskell is already > quite a mouthfull to learn. This worries me too. Not least is the problem that <- is not a particularly natural syntax for this

pattern guards and guarded patterns

1997-04-30 Thread Chris Dornan
In `A new view of guards', Simon cited > [2] W Burton, E Meijer, P Sansom, S Thompson, P Wadler, "A (sic) extension > to Haskell 1.3 for views", sent to the Haskell mailing list > 23 Oct 1996 Was that posted on this Haskell mailing list? Does anyone know where I could get a copy

Re: pattern guards and guarded patterns

1997-04-30 Thread Simon L Peyton Jones
Thanks for feedback about pattern guards. Here are some quick responses. 1. Several people have suggested something along the lines of being able to backtrack half way through a pattern guard. I considered this but (a) I couldn't see a nice syntax for it and (b) it's against the spirit of