On Mon, Aug 02, 2004 at 10:54:33PM +0200, [EMAIL PROTECTED] wrote:
> The operators can be also defined as follows:
>    (.&.) f g x = (f x) && (g x)
>    (.|.) f g x = (f x) || (g x)
> 
> It is clear from these definitions, that the operators are ternary
> operators.
> 
> As operators are essentially the same as functions, in Haskell, any number
> of parameters can be given in an operator definition.

You might be interested in my BooleanAlgebra class, which replaces the
various boolean operators from the prelude with overloaded versions
with various useful instances. 

The really nice thing is the instance for Bool is exactly the same as
the prelude version so this can be dropped into existing code without
change (modulo the monomorphism restriction).

In particular, there is an instance for the boolean algebra of
predicates, so you can say f && g directly where f and g are functions
which return bool.

http://repetae.net/john/recent/out/Boolean.html

it also gives you perl-like short circuting, so 
Just 'a' || Just 'b' -> Just 'a' 
and so forth...

        John

-- 
John Meacham - ârepetae.netâjohnâ 
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to