Iavor Diatchki wrote: > 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 ...
Not having used pattern guards so far, can't you write? server text = case parse text of Just xs | "field1" `elem` xs -> ... do one thing ... | "field2" `elem` xs -> ... do something else ... _ -> ... invalid request ... Christian _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell