[Haskell-beginners] cascade of if statements

Emmanuel Touzery etouzery at gmail.com
Wed Oct 31 23:03:30 CET 2012


Thank you that is very interesting... this is really impressive with
haskell that it's so "easy" to add such operators, that they don't need to
be builtin.

Thanks for your time, it was not wasted!

On Wed, Oct 31, 2012 at 6:26 PM, Daniel Trstenjak <
daniel.trstenjak at gmail.com> wrote:

>
> 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
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20121031/2b578f5a/attachment-0001.htm>


More information about the Beginners mailing list