On Fri, Mar 16, 2012 at 12:30:13PM +0100, Twan van Laarhoven wrote:
> 
> If you want to avoid the side effects of boolTest2 when boolTest1
> returns true, you will need to implement a monadic or, something like
> 
>     orM ma mb = do
>         a <- ma
>         if a then return True else mb

Note also that it is *not possible* to have this short-circuiting
behavior using only Applicative.  The structure of an Applicative
computation is always fixed up front, and cannot depend on
intermediate values.

-Brent

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to