Re: [GHC] #3822: pattern guards in arrow notation (Arrows extension) case statement cause compiler panic

2010-01-15 Thread GHC
#3822: pattern guards in arrow notation (Arrows extension) case statement cause compiler panic --+- Reporter: StephenBlackheath | Owner: Type: bug

Re: [GHC] #3822: pattern guards in arrow notation (Arrows extension) case statement cause compiler panic

2010-01-15 Thread GHC
#3822: pattern guards in arrow notation (Arrows extension) case statement cause compiler panic --+- Reporter: StephenBlackheath | Owner: Type: bug

Re: [GHC] #3822: guards in arrow notation (Arrows extension) case statement cause compiler panic (was: pattern guards in arrow notation (Arrows extension) case statement cause compiler panic)

2010-01-15 Thread GHC
-time crash --+- Changes (by ross): * keywords: arrows pattern guards case panic = arrows guards case panic * os: Linux = Unknown/Multiple * architecture: x86_64 (amd64) = Unknown/Multiple -- Ticket URL: http

Re: [GHC] #2017: Normal Guards are internally spliced as Pattern Guards causing compiler warnings

2008-01-14 Thread GHC
#2017: Normal Guards are internally spliced as Pattern Guards causing compiler warnings --+- Reporter: fons | Owner: igloo Type: merge | Status: closed Priority: normal

Re: [GHC] #2017: Normal Guards are internally spliced as Pattern Guards causing compiler warnings

2008-01-07 Thread GHC
#2017: Normal Guards are internally spliced as Pattern Guards causing compiler warnings --+- Reporter: fons | Owner: igloo Type: merge | Status: new Priority: normal

pattern guards: recent changes to draft haskell prime report

2007-01-12 Thread isaac jones
Greetings! We've been working to add pattern guards to the Haskell' report, and doing some cleanup work on the repository. Not all of the emails are making it to the list, sadly, but here's a list of recent changes from the report. You can view the report itself here (I couldn't think

patch applied (haskell-prime-report): update pattern binding translation for pattern guards (with Iavorapos; s help!)

2007-01-11 Thread Isaac Jones
Thu Jan 11 15:51:14 PST 2007 [EMAIL PROTECTED] * update pattern binding translation for pattern guards (with Iavor's help!) M ./report/decls.verb -7 +9 ___ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman

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

2006-12-14 Thread Claus Reinke
account of types, and read every ((e :: Bool) :: Monad m = m _) in a statement of a do block as a shorthand for (guard (e :: Bool) :: Monad m = m ()) (b) missing return in pattern guards this could be made to fit the general pattern, if we had (return == id

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-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 it any more

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 there is no

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

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 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 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 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 statements

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. Oh, and case.

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

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: (Pattern) Guards in lambdas

2006-10-19 Thread Simon Marlow
[EMAIL PROTECTED] wrote: suggestion: undo removal of guards from lambdas, especially (but not only) if pattern guards make it into the language. See the existing proposals http://hackage.haskell.org/trac/haskell-prime/wiki/LambdaCase http://hackage.haskell.org/trac/haskell-prime/wiki

Re: (Pattern) Guards in lambdas

2006-10-19 Thread John Meacham
On Thu, Oct 19, 2006 at 12:55:48PM +0100, Simon Marlow wrote: As for extending lambda to allow multiple guards and/or multiple pattern matches, I don't think we need that either. Lambda is a quiet syntax and will be lost at the beginning of a sequence of pattern matches/guards; it's best used

Re: (Pattern) Guards in lambdas

2006-10-18 Thread Malcolm Wallace
Claus Reinke [EMAIL PROTECTED] wrote: since Pattern Guards appear to be popular with the committee, I suggest to revisit the decision to drop guards from lambdas: suggestion: undo removal of guards from lambdas, especially (but not only) if pattern guards make it into the language. See

Re: (Pattern) Guards in lambdas

2006-10-18 Thread Claus Reinke
suggestion: undo removal of guards from lambdas, especially (but not only) if pattern guards make it into the language. See the existing proposals http://hackage.haskell.org/trac/haskell-prime/wiki/LambdaCase http://hackage.haskell.org/trac/haskell-prime/wiki/MultiWayIf thanks. I'm

Re[2]: (Pattern) Guards in lambdas

2006-10-18 Thread Bulat Ziganshin
Hello Claus, Wednesday, October 18, 2006, 2:44:29 PM, you wrote: (\ arms ) x this looks great. smth like: proc $ \[x] - x*2 \[x,y] - x*y \[]- 0 -- Best regards, Bulatmailto:[EMAIL PROTECTED]

(Pattern) Guards in lambdas

2006-10-17 Thread Claus Reinke
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

[Haskell] Re: Replacing and improving pattern guards with PMC syntax

2006-10-04 Thread Jacques Carette
to function-level instead), and finally spliced back (turning explicit into implicit match failure) using fromJust or suchlike. Adding pattern guards into this translation was straightforward - they simply go between the two returns. Note that it is very much this issue of 'monadic choice

Re: Replacing and improving pattern guards with PMC syntax

2006-10-04 Thread Jacques Carette
to function-level instead), and finally spliced back (turning explicit into implicit match failure) using fromJust or suchlike. Adding pattern guards into this translation was straightforward - they simply go between the two returns. Note that it is very much this issue of 'monadic choice

[Haskell] Re: Replacing and improving pattern guards with PMC syntax

2006-10-03 Thread apfelmus
core, which thus becomes more complex, without offering sufficient compensation in terms of expressiveness. I agree. The pattern matching problem is best solved by supplying sugar which either is compositional or fundamental. The compositional structure behind pattern guards is of course

[Haskell] Re: Replacing and improving pattern guards with PMC syntax

2006-10-03 Thread apfelmus
I see that = is already used... Let's take ~ (tilde) instead. A pseudo-sugared version in plain Haskell for f (Right (Right p)) = p f (Left p) = p f p = p that is f p = fromJust $ | Right q ~ p | Right r ~ q = r | Left q ~ p = q |

Re: Replacing and improving pattern guards with PMC syntax

2006-10-03 Thread apfelmus
core, which thus becomes more complex, without offering sufficient compensation in terms of expressiveness. I agree. The pattern matching problem is best solved by supplying sugar which either is compositional or fundamental. The compositional structure behind pattern guards is of course

[Haskell] Re: Replacing and improving pattern guards with PMC syntax

2006-10-02 Thread Claus Reinke
(the examples I gave moved the \s to the front instead and used mplus to compose matchings, but we could also lift the compositions to function-level instead), and finally spliced back (turning explicit into implicit match failure) using fromJust or suchlike. Adding pattern guards

Re: [Haskell] Replacing and improving pattern guards with PMC syntax

2006-10-02 Thread kahl
Brandon Moore [EMAIL PROTECTED] wrote in his answer to my PMC syntax proposal: Maybe the '\' could be reiterated to introduce the layout group: take' = \ 0 _ - [] n \[] - [] (x:x) - x : take (pred n) xs Definitely not, since the lambda gets us back into expressions, destroying the

[brand...@yahoo-inc.com: Re: [Haskell] Replacing and improving pattern guards with PMC syntax]

2006-10-02 Thread kahl
and improving pattern guards with PMC syntax In-Reply-To: [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: ... So far I never considered it important to devise a concrete syntax for PMC, but triggered by the current pattern guards thread on haskell-prime, I now try to give a PMC syntax that blends well

Re: Pattern guards

2006-10-02 Thread Yitzchak Gale
I wrote: ...the main monad at work here is the Exit monad. Ross Paterson wrote: ...if we define exitMaybe :: Exit e () - Maybe e exitMaybe (Continue _) = Nothing exitMaybe (Exit e) = Just e then we have runExit m = fromJust (exitMaybe m) exitMaybe (x

Re: Pattern guards

2006-10-02 Thread Yitzchak Gale
, and restricted to something like the exit monad you mention in pattern guards. They are all consistent uses of (-). No, they are not the same. Bind in a list comprehension translates to the exact same bind in do notation. I cannot think of any translation of pattern guards for which the same thing

Re: Pattern guards

2006-10-02 Thread Ross Paterson
On Mon, Oct 02, 2006 at 11:58:44PM +0200, Yitzchak Gale wrote: Ross Paterson wrote: ...if we define exitMaybe :: Exit e () - Maybe e exitMaybe (Continue _) = Nothing exitMaybe (Exit e) = Just e Maybe monads quit on failure and continue on success. We want the

Re: Replacing and improving pattern guards with PMC syntax

2006-10-02 Thread Claus Reinke
(the examples I gave moved the \s to the front instead and used mplus to compose matchings, but we could also lift the compositions to function-level instead), and finally spliced back (turning explicit into implicit match failure) using fromJust or suchlike. Adding pattern guards

[Haskell-cafe] Re: [Haskell] Replacing and improving pattern guards with PMC syntax

2006-10-02 Thread Brandon Moore
[EMAIL PROTECTED] wrote: ... So far I never considered it important to devise a concrete syntax for PMC, but triggered by the current pattern guards thread on haskell-prime, I now try to give a PMC syntax that blends well with Haskell. I think with some alterations your syntax would blend

[Haskell] Replacing and improving pattern guards with PMC syntax

2006-10-01 Thread kahl
--- the confluence proof has been mechanised using Isabelle. So far I never considered it important to devise a concrete syntax for PMC, but triggered by the current pattern guards thread on haskell-prime, I now try to give a PMC syntax that blends well with Haskell. PMC ``automatically'' includes

Re: Pattern guards

2006-10-01 Thread Ross Paterson
On Sun, Oct 01, 2006 at 02:08:35AM +0200, Yitzchak Gale wrote: An important clarification: the main monad at work here is the Exit monad. The bind notation in a pattern guard is just an obfuscated Exit monad. However, in many simple examples, the Maybe monad can be used as a special case of

Re: Pattern guards

2006-09-30 Thread Conor McBride
Claus Reinke wrote: If it wasn't for those pesky returns/guards, one might claim the translations to be as concise as the originals. As it stands, the results of the translation are rather more awkward but -and this is the important point- pattern guards do not add new functionality. Well

Re: Pattern guards

2006-09-30 Thread Yitzchak Gale
is incomplete... This translation does not appear to address programs with multiple left-hand sides, exploiting fall-through from match (hence guard) failure Quite right, sorry. That is easy to fix. A corrected proof is at the bottom of this message. David Roundy wrote: If all your pattern guards

Re: Pattern guards

2006-09-30 Thread Yitzchak Gale
Conor McBride wrote: Claus Reinke wrote: ...the results of the translation are rather more awkward but -and this is the important point- pattern guards do not add new functionality. Well, neither do Boolean guards nor even basic pattern matching... one simply should not need to clutter

Re: Pattern guards

2006-09-30 Thread Sebastian Sylvan
On 10/1/06, Yitzchak Gale [EMAIL PROTECTED] wrote: Conor McBride wrote: Claus Reinke wrote: ...the results of the translation are rather more awkward but -and this is the important point- pattern guards do not add new functionality. Well, neither do Boolean guards nor even basic

Pattern guards

2006-09-28 Thread Yitzchak Gale
I would like to suggest a correction to ticket #56, Pattern Guards. It is easy to show that every expression written using pattern guards can also be written in Haskell 98 in a way that is essentially equivalent in simplicity. (Proof below.) In my opinion, the Haskell 98 version below is more

Re: Pattern guards

2006-09-28 Thread Ross Paterson
On Thu, Sep 28, 2006 at 04:40:30PM +0300, Yitzchak Gale wrote: Now given any function binding using pattern guards: funlhs | qual11, qual12, ..., qual1n = exp1 | qual21, qual22, ..., qual2n = exp2 ... we translate the function binding into Haskell 98 as: funlhs = runExit $ do

Re: Pattern guards

2006-09-28 Thread Conor McBride
Hi Yitzchak Gale wrote: I would like to suggest a correction to ticket #56, Pattern Guards. It is easy to show that every expression written using pattern guards can also be written in Haskell 98 in a way that is essentially equivalent in simplicity. (Proof below.) Whether or not your

Re: Pattern guards

2006-09-28 Thread Iavor Diatchki
Hello, I think that pattern guards are a nice generalization of ordinary guards and they should be added to the language. Of course, as you point out, we can encode them using the Maybe monad, but the same is true for nested patterns, and I don't think that they should be removed from Haskell

Re[2]: Pattern guards

2006-09-28 Thread Bulat Ziganshin
Hello Conor, Thursday, September 28, 2006, 10:30:46 PM, you wrote: gcd x y | compare x y - LT = gcd x (y - x) GT = gcd (x - y) y gcd x _ = x or some such. I wish I could think of a better example without too much context, but such a thing escapes me for the moment. In general,

Re: Re[2]: Pattern guards

2006-09-28 Thread Iavor Diatchki
Hello, This particular example we can do with pattern guards (although it seems that a simple 'case' is more appropriate for this example) On 9/28/06, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Conor, Thursday, September 28, 2006, 10:30:46 PM, you wrote: gcd x y | compare x y - LT

Re: Pattern guards

2006-09-28 Thread David Roundy
On Fri, Sep 29, 2006 at 02:59:49AM +0300, Yitzchak Gale wrote: Iavor Diatchki wrote: I think that the benefit of adding pattern guards is... it provides a concise notation Not significantly more concise than existing notation. That's just not true. If all your pattern guards happen

Re: Bug in users manual, 6.4.2, section on pattern guards

2006-07-21 Thread Simon Marlow
Matthew Cox wrote: One example given in this discussion is: clunky env var1 var1 = case lookup env var1 of Nothing - fail Just val1 - case lookup env var2 of Nothing - fail Just val2 - val1 + val2 where fail = val1 + val2 this needs to be fixed to: clunky env var1 var1 = case

Bug in users manual, 6.4.2, section on pattern guards

2006-07-20 Thread Matthew Cox
One example given in this discussion is: clunky env var1 var1 = case lookup env var1 of Nothing - fail Just val1 - case lookup env var2 of Nothing - fail Just val2 - val1 + val2 where fail = val1 + val2 this needs to be fixed to: clunky env var1 var1 = case lookup env var1 of

[Haskell] No Pattern Guards

2005-03-28 Thread Yitzchak Gale
I posted a link to the following on the HaskellTwo wiki page. Please comment. I would like to suggest that PatternGuards NOT be included in HaskellTwo. While I enjoyed Simon Peyton Jones' well-written note on pattern guards [http://research.microsoft.com/Users/simonpj/Haskell/guards.html] very

Re: [Haskell] No Pattern Guards

2005-03-28 Thread John Meacham
On Mon, Mar 28, 2005 at 02:17:46PM +0200, Yitzchak Gale wrote: I posted a link to the following on the HaskellTwo wiki page. Please comment. I would like to suggest that PatternGuards NOT be included in HaskellTwo. While I enjoyed Simon Peyton Jones' well-written note on pattern guards

Re: [Haskell] No Pattern Guards

2005-03-28 Thread Claus Reinke
Now generalize it to more than two cases, or one where the second case needs to pattern match too. The magic of pattern guards is not in a single guarding expression, but in a function with many different cases which use pattern guards. MonadPlus is your friend, especially if (fail s

[Haskell] Pattern guards and algebraic datatypes

2004-06-18 Thread Graham Klyne
At 15:33 17/06/04 -0700, John Meacham wrote: I think it was a couple things, Pattern guards were introduced which were conceptually a whole lot simpler and provided a way to do many of the things views did. http://research.microsoft.com/~simonpj/Haskell/guards.html I like that proposal

Pattern guards vs. case (was, unfortunately :Re: interesting example of laziness/ghc optimisation)

2001-03-01 Thread Ketil Malde
(Apologies, I forgot to change the subject) Laszlo Nemeth [EMAIL PROTECTED] writes: * * * Ketil Malde [EMAIL PROTECTED] wrote: There is no difference. The 'pipe-syntax' (or pattern guards) gets desugared (by the pattern matching compiler) to case statements i.e.: runRandom = \ last max

Re: Pattern guards vs. case (was, unfortunately :Re: interesting example of laziness/ghc optimisation)

2001-03-01 Thread John Meacham
On Thu, Mar 01, 2001 at 09:40:48AM +0100, Ketil Malde wrote: (Apologies, I forgot to change the subject) Laszlo Nemeth [EMAIL PROTECTED] writes: * * * Ketil Malde [EMAIL PROTECTED] wrote: There is no difference. The 'pipe-syntax' (or pattern guards) gets desugared (by the pattern

Re: Pattern guards vs. case

2001-03-01 Thread Malcolm Wallace
runRandom last max num | num 1 = runRandom (fst new) max (num-1) | otherwise = snd new What's the difference between the pipe-syntax, and a case statement, i.e. writing the function as runRandom last max num = case num of 1 - runRandom otherwise - snd new

Re: Pattern guards vs. case (was, unfortunately :Re: interesting example of laziness/ghc optimisation)

2001-03-01 Thread Laszlo Nemeth
* * * Ketil Malde [EMAIL PROTECTED] wrote: ut - the converse is not true, is it? I can write ... = case foo of (Foo f) - ... (Bar b) - ... ut I can't express that as a pattern-guarded expression, can I? You probably have already seen John's reply

Re: Pattern guards vs. case (was, unfortunately :Re: interesting exampleof laziness/ghc optimisation)

2001-03-01 Thread Johannes Waldmann
But if you want to be really weird you can write something like (I haven't typed this in): f x | (Foo _) == x = f x | (Bar _) == x = no, you can't, e. g. hugs (Feb 2000) says Prelude let f x | Just 4 == x = 0 in f (Just 4) 0 Prelude let f x | Just _ == x = 0 in f (Just 4) ERROR: Illegal

Re: Pattern guards vs. case (was, unfortunately :Re: interesting exampleof laziness/ghc optimisation)

2001-03-01 Thread Laszlo Nemeth
* * * Johannes Waldmann wrote: But if you want to be really weird you can write something like (I haven't typed this in): f x | (Foo _) == x = f x | (Bar _) == x = no, you can't, e. g. hugs (Feb 2000) says Prelude let f x | Just 4 == x = 0 in f (Just 4) 0 Prelude let f x |

RE: pattern guards

1999-11-24 Thread Simon Peyton-Jones
08:58 | To: Simon Peyton-Jones | Cc: [EMAIL PROTECTED] | Subject: pattern guards | | | Hi Simon, | | I dimly recall that ghc once supported pattern guards, which | was (if I | remember correctly) some way to bind variables in the guard of a | pattern match. Is this feature still available

RE: Nested pattern guards.

1998-10-05 Thread Alex Ferguson
top of my head are: taste and decency; and perhaps heavy reliance on the offside rule, which might be a bad thing if equation groups get infeasibly large. The beauty of flat pattern guards is that they have the same syntax as qualifiers in list comprehensions. Surely this would also be t

RE: Nested pattern guards.

1998-10-05 Thread Simon Peyton-Jones
Hi all. Was there ever any sort of consensus about whether pattern guards ought to be "nestable", or not? And if not, was there some semantic objection to this, was the syntax just considered to Unspeakable to be spoken of, or is the feature just largely redundant? (I thi

Nested pattern guards.

1998-10-01 Thread Alex Ferguson
Hi all. Was there ever any sort of consensus about whether pattern guards ought to be "nestable", or not? And if not, was there some semantic objection to this, was the syntax just considered to Unspeakable to be spoken of, or is the feature just largely redundant? (I think you

Re: Pattern guards

1997-05-15 Thread Simon L Peyton Jones
| f c | (i,j) - Just (toRect c) = ... | | I'm afraid this example suffers from the same problem as my "simplify" | example did: It does not perform a test and can thus be replaced by | | f c = ... | where (i,j) = toRect c True. I can think of two non-contrived ways in which this

Re: pattern guards + monads

1997-05-15 Thread Malcolm Wallace
I am having a little trouble following the two discussions on pattern guards and monads, due to some (probably minor) confusing pieces of syntax. Would anyone like to clarify these for me? It would help me to understand the underlying issues. Thanks. On pattern guards, Simon PJ writes

Re: pattern guards + monads

1997-05-15 Thread Philip Wadler
Now, for monads, Phil Wadler writes a law: m = \x - k x ++ h x = m = k ++ n = k in which 'h' appears on the lhs but not the rhs, and 'n' on the rhs but not the lhs. ... perhaps the equation should read as follows? m = \x - k x ++ h x = m = k ++ m = h Yes, of course it

Re: Pattern guards

1997-05-14 Thread Greg Michaelson
Simon wrote: For example, in this case we could write (rather less elegantly) g2 a | (x:xs) - h a, (y:ys) - h x = if y0 then e1 else if y0 then e2 else e3 To avoid this difficulty with functions like g2...

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 Alex Ferguson
and can't be made to, do any sort of pattern-binding, so it's not possible to express pattern guards like this. (Or reduce them to such in the same style of translation as Chris gave.) Brian Boutel comments on Simon's: CONCLUSION: "let" should be allowed, but should introduce mul

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'

pattern guards and guarded patterns

1997-04-30 Thread Chris Dornan
get a copy of this proposal? I would really welcome feedback on this proposal Here goes, ... Reaction to Pattern Guards == * I am sure that I have been nobbled by the lack of pattern guards regularly but have got used to clunking my way round the p

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 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

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