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 much, it was written a long time ago. Today it is easy to recognize that the problem he identifies is just the need for a monad, and that his proposed solution is a new syntax for introducing monadic calculations. The new syntax is messier and less general than the existing "do".
Furthermore, the new syntax confuses the semantics of existing constructs.
Referring to Simon's principal example in his note, here is one way to write "clunky" without PatternGuards:
> clunky env var1 var2 = fromMaybe (var1 + var2) $ do > val1 <- lookup env var1 > val2 <- lookup env var2 > return (val1 + val2)
Simple, clear, and scalable.
-YitzGale _______________________________________________ Haskell mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell
