1 Dec
2004
1 Dec
'04
3:34 a.m.
On Tue, Nov 30, 2004 at 06:36:46PM +0000, Pavel Zolnikov wrote:
The problem is that code on line 4 is useless. If one of the arguments a or b is Nothing, computation will just return Nothing and will not bother to execute lines 4-5:
1 foo a b = do 2 output "before" 3 let r = liftM2 (+) a b 4 when (r == Nothing) $ output "error" 5 return r -- ??? "lift r"
Obviously you are talking about your version of code (with "r <- liftM2..."), because for Mike's code your statement isn't true. How can "let" abort the computation? Best regards, Tomasz