As usual you can check:
Hi everyone.I was wondering if I can make assumptions about the evaluation order ofthe following code:isTrue :: Int -> IO BoolisTrue val = pure (||) <*> boolTest1 val <*> boolTest2 val{- boolTest1 is an inexpensive, quick check -}boolTest1 :: Int -> IO BoolboolTest1 val = undefined
{- boolTest2 is a very expensive check -}boolTest2 :: Int -> IO BoolboolTest2 val = undefinedWhen using Applicative in the isTrue function, I would like to make use ofthe short-circuit behaviour of || and rely on the fact that the boolTest1will be executed first. The reason I am asking is because the boolTest functionsare in the IO monad, instead of just returning pure Bool values.RegardsRouan.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe