[Haskell-cafe] Re: Improved documentation for Bool

ajb at spamcop.net ajb at spamcop.net
Mon Jan 19 19:22:07 EST 2009

G'day all.

On Mon, 2009-01-19 at 19:33 +0000, Andrew Coppin wrote:

>> My only problem with it is that it's called Bool, while every other
>> programming language on Earth calls it Boolean. (Or at least, the
>> languages that *have* a name for it...)

Jonathan Cast commented:

> Except C++?

And perhaps more to the point, "Boolean" is an adjective, not a noun.
Therefore, it would be better reserved for a typeclass.

class (PartialOrder a) => JoinSemilattice a where
     (||) :: a -> a -> a

class (MeetSemilattice a) => BoundedJoinSemilattice a where
     bottom :: a

class (PartialOrder a) => MeetSemilattice a where
     (&&) :: a -> a -> a

class (MeetSemilattice a) => BoundedMeetSemilattice a where
     top :: a

class (BoundedJoinSemilattice a, BoundedMeetSemilattice a) => Heyting a where
     implies :: a -> a -> a

     not :: a -> a
     not x = x `implies` bottom

class (Heyting a) => Boolean a where
     {- the additional axiom that x || not x == top -}

Andrew Bromage

More information about the Haskell-Cafe mailing list