
8 Dec
2007
8 Dec
'07
12:33 p.m.
On Dec 8, 2007 3:12 PM, Ilya Tsindlekht
wrote: On Sat, Dec 08, 2007 at 02:59:16PM -0200, Felipe Lessa wrote:
Prelude> do {1 <- return 3; return' "ok"} Nothing Prelude> return 3 >>= \1 -> return' "ok" *** Exception: <interactive>:1:13-30: Non-exhaustive patterns in lambda What seems confusing to you?
\1 -> foo is the same as \x -> case x of {1 -> foo;}
When this function is evaluated with parameter different from 1, Haskell fails to find matching pattern for x and exception occurs.
The problem is that with the do notation it doesn't raise an exception. In the example you quoted, Yes, I have already understood it from your reply to the original
On Sat, Dec 08, 2007 at 03:28:58PM -0200, Felipe Lessa wrote: poster.