[Haskell-cafe] Eq Type Class: Overloading (==)

John Meacham john at repetae.net
Sun Sep 18 20:22:51 EDT 2005

On Fri, Sep 16, 2005 at 11:14:14PM -0700, Jason Dagit wrote:
> This reminds me that several times now I've wished that Bool was some  
> sort of interface instead of a type.  Perhaps Bool could be a type  
> class?  I also wish that "if" were a function, but that's probably  
> just the lisper in me speaking.  Something like:

See my Boolean.Algebra module. it lets you declare types to be boolean
algebras (or lift an arbitrary type to such an algebra) and provides a
lot of useful functions on them. although, it sometimes feels like it
should be a general lattice class. 


darcs repo:  http://repetae.net/john/repos/Boolean

some examples of where I have used this are.

in ginsu you can have filters to choose which messages to see. I just
created the basic regex filter and lifted it to a full boolean alegbra
on them with Boolean.Boolean.

In jhc I accumulate various properties of programs with generic routines
that accumulate arbitrary types of class boolean.

"fuzzy" booleans implemented as doubles have found their way into some

and some other places...


John Meacham - ⑆repetae.net⑆john⑈ 

More information about the Haskell-Cafe mailing list