Indeed this makes sense.  See Section 3 of
        http://research.microsoft.com/~simonpj/Papers/pat.htm

It's really the syntactic/notational problem that has put me off every doing 
something like this.  I just couldn't come up with a compelling syntax.  (The 
syntax GHC uses has the great merit that it's identical to that for list 
comprehensions.)

Simon

| -----Original Message-----
| From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Iavor Diatchki
| Sent: 04 December 2007 19:42
| To: Haskell users
| Subject: [Haskell] Nested guards?
|
| Hi,
| Lately I have been using pattern guards more than usual and I find
| that occasionally I need to nest them (i.e., I have alternatives with
| a common prefix).  This seems to happen when I need to do some
| preliminary checking, followed by some decision making.  Here is an
| example:
|
| server text
|    | Just xs <- parse text
|    ,   | "field1" `elem` xs   = ... do one thing ...
|        | "field2" `elem` xs   = ... do something else ...
|
| server  _ = ... invalid request ...
|
| As far as I can see this should be a fairly simple change to the
| pattern bindings extension.   Would anyone else find this a useful
| feature, and if so what syntax should we use?
|
| -Iavor
| _______________________________________________
| Haskell mailing list
| Haskell@haskell.org
| http://www.haskell.org/mailman/listinfo/haskell
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to