On 2006-02-16, Claus Reinke <[EMAIL PROTECTED]> wrote: >> Oh golly. I can't live without pattern guards. they are the best darn >> thing since sliced bread. I highly recommend them. I .. would have >> to seriously refactor a ton of code if pattern guards disapeared. >> >> So much so that it would be less work to implement pattern guards for >> other compilers and submit the patches. > > eh, well, pattern guards are nice. but, many of their uses are also > easily replaced, by moving the pg-monad from the lhs to the rhs, > and employing MonadPlus for the fall-throughs; something roughly > like: > > f p1 | g1 = e1 > .. > f pn | gn = en > where <stuff> > > --> > > f x = fromJust $ do {p1 <- return x; guard g1; return e1} > .. > `mplus` do {pn <- return x; guard gn; return en} > where <stuff>
This works, of course, but it looks far far uglier, and is harder to type. -- Aaron Denney -><- _______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime