strictly matching monadic let and overloaded Bool (was: Are pattern guards obsolete?)

2006-12-14 Thread Claus Reinke
consider the following examples: -- do-notation: explicit return; explicit guard; monadic result d _ = do { Just b <- return (Just True); guard b; return 42 } -- list comprehension: explicit return; implicit guard; monadic (list) result lc _ = [ 42 | Just b <- return (Just True), b

Re: Are pattern guards obsolete?

2006-12-13 Thread Dave Menendez
Yitzchak Gale writes: > Philippa Cowderoy wrote: > >> I don't find it any more confusing than the overloading > >> of ->. > > I wrote: > > You mean that it is used both for lambda abstractions > > and for functional dependencies? True, but those > > are so different that there is no confusion. >

Re: Are pattern guards obsolete?

2006-12-13 Thread Claus Reinke
does this clarify things? No. Pattern guards are "obvious", they could only work in one particular way, and they do work that way. They make common things easier, and increase abstraction. If your only argument against them requires category theory, then I'd say that's a pretty solid reason for

Re: Are pattern guards obsolete?

2006-12-13 Thread Neil Mitchell
Hi in spite of their similarity, all of these constructs handle some of the monadic aspects differently. the translations of pattern guards not only embed statements in "guard", they also embed the right hand sides of generators in "return". translations of list comprehensions only lift statemen

Re: Are pattern guards obsolete?

2006-12-13 Thread Claus Reinke
I am not clear why you think the current notation is confusing... Could you give a concrete example? I am thinking of something along the lines: based on how "<-" works in list comprehensions and the do notation, I would expect that pattern guards do XXX but instead, they confusingly do YYY. I

Re: Are pattern guards obsolete?

2006-12-13 Thread apfelmus
Iavor Diatchki wrote: > I am not clear why you think the current notation is confusing... > Could you give a concrete example? I am thinking of something along > the lines: based on how "<-" works in list comprehensions and the do > notation, I would expect that pattern guards do XXX but instead,

Re: Are pattern guards obsolete?

2006-12-13 Thread Iavor Diatchki
Hi, I am not clear why you think the current notation is confusing... Could you give a concrete example? I am thinking of something along the lines: based on how "<-" works in list comprehensions and the do notation, I would expect that pattern guards do XXX but instead, they confusingly do YYY

Re: Are pattern guards obsolete?

2006-12-13 Thread Yitzchak Gale
Philippa Cowderoy wrote: This is what I get for replying straight away! Oh, no, I'm happy that you responded quickly. I think my point is that I'm not aware of many people who actually think this is a problem or get confused. Well, I don't mean that this is something that experienced Haskel

Re: Are pattern guards obsolete?

2006-12-13 Thread Philippa Cowderoy
On Wed, 13 Dec 2006, Yitzchak Gale wrote: > Philippa Cowderoy wrote: > > > I don't find it any more confusing than the overloading > > > of ->. > > I wrote: > > You mean that it is used both for lambda abstractions > > and for functional dependencies? True, but those > > are so different that the

Re: Are pattern guards obsolete?

2006-12-13 Thread Philippa Cowderoy
On Wed, 13 Dec 2006, Yitzchak Gale wrote: > Yitzchak Gale wrote: > > > Of course, this is not really the joy of > > > pattern guards. It is the joy of monads, > > > with perhaps a few character strokes > > > saved by a confusing overloading of (<-). > > Philippa Cowderoy wrote: > > I don't find i

Re: Are pattern guards obsolete?

2006-12-13 Thread Yitzchak Gale
Philippa Cowderoy wrote: I don't find it any more confusing than the overloading of ->. I wrote: You mean that it is used both for lambda abstractions and for functional dependencies? True, but those are so different that there is no confusion. Oh, and case. Also quite different. But, hmm, p

Re: Are pattern guards obsolete?

2006-12-13 Thread Yitzchak Gale
Donald Bruce Stewart <[EMAIL PROTECTED]> wrote: The joy of pattern guards reveals once you have more conditions. I wrote: Of course, this is not really the joy of pattern guards. It is the joy of monads, with perhaps a few character strokes saved by a confusing overloading of (<-). Philippa

Re: Are pattern guards obsolete?

2006-12-12 Thread Philippa Cowderoy
On Wed, 13 Dec 2006, Yitz Gale wrote: > Donald Bruce Stewart <[EMAIL PROTECTED]> writes: > > The joy of pattern guards > > reveals once you have more conditions. > > Of course, this is not really the joy of > pattern guards. It is the joy of monads, > with perhaps a few character strokes > saved

Re: Are pattern guards obsolete?

2006-12-12 Thread Yitz Gale
Donald Bruce Stewart <[EMAIL PROTECTED]> writes: > The joy of pattern guards > reveals once you have more conditions. Of course, this is not really the joy of pattern guards. It is the joy of monads, with perhaps a few character strokes saved by a confusing overloading of (<-). But some people do