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
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.
>
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
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
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
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,
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
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
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
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
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
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
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
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
14 matches
Mail list logo