[Haskell-cafe] What puts False before True?
Henning Thielemann
lemming at henning-thielemann.de
Fri Jun 1 08:25:28 EDT 2007
On Thu, 31 May 2007, Paul Hudak wrote:
> PR Stanley wrote:
> >> I think so, too. In Boolean algebra (which predates computers, much less
> >> C), FALSE has traditionally been associated with 0, and TRUE with 1. And
> >> since 1 > 0, TRUE > FALSE.
> > The question, however, still remains: why False = 0 and True 1? I
> > appreciate that it's so in boolean algebra but why? Why not True = 0
> > and False = 1?
>
> Because if you take (&&) to be (*), and (||) to be (+), you get a
> homomorphism between the two resulting algebras (assuming 1+1 = 1).
It seems however, that if the number representations of False and True
are flipped, then we only need to flip the interpretations of (&&) and
(||).
For me the choice fromEnum False == 0 && fromEnum True == 1 seems rather
arbitrary. The conversion is certainly useful for writing Bool values to
binary files. Maybe the Ord instance was introduced in order to be able to
put Bools in Sets and Maps. However this confirms my doubts whether using
Ord constraint for Sets and Maps was a good choice.
http://www.haskell.org/pipermail/libraries/2007-April/007411.html
More information about the Haskell-Cafe
mailing list