[Haskell-beginners] cascade of if statements
Daniel Trstenjak
daniel.trstenjak at gmail.com
Wed Oct 31 18:26:14 CET 2012
On Wed, Oct 31, 2012 at 06:14:52PM +0100, Daniel Trstenjak wrote:
> (<&&>) :: Monad m => m Bool -> m Bool -> m Bool
> (<&&>) m1 m2 = do
> r1 <- m1
> if r1 then m2 else return False
>
>
> (<||>) :: Monad m => m Bool -> m Bool -> m Bool
> (<||>) m1 m2 = do
> r1 <- m1
> if r1 then return True else m2
That the operators behave like the boolean ones we should have the same fixity declarations:
infixr 3 (<&&>)
infixr 2 (<||>)
Greetings,
Daniel
More information about the Beginners
mailing list