From: ijones@syntaxpolice.org Date: Sun, 7 Jan 2007 21:52:49 +0000 (+0000) Subject: Fixed errors in "clunky" definition for pattern guards X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=63006863be568d5cbb21d3198d43859c743152ce Fixed errors in "clunky" definition for pattern guards Amusingly, this little error in the GHC manual came from the original SPJ proposal for pattern guards from 1997 and even slipped into the Haskell Workshop 2000 paper by SPJ and Martin Erwig. It's almost 10 years old. --- diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index 41bba18..6dfda6b 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -620,7 +620,7 @@ to write clunky would be to use case expressions: -clunky env var1 var1 = case lookup env var1 of +clunky env var1 var2 = case lookup env var1 of Nothing -> fail Just val1 -> case lookup env var2 of Nothing -> fail @@ -645,7 +645,7 @@ Here is how I would write clunky: -clunky env var1 var1 +clunky env var1 var2 | Just val1 <- lookup env var1 , Just val2 <- lookup env var2 = val1 + val2