[Haskell-cafe] Re: not possible with monad transformers ?
tomasz.zielonka at gmail.com
Tue Nov 30 14:34:29 EST 2004
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
More information about the Haskell-Cafe