
On Mon, Sep 29, 2014 at 12:21 PM, Gershom B
I can think of three uses for the Bool instance for bits. First, because `xor` may be a more clear name than (/=) for a use of Bool. Second, to test a generic operation on Bits in a minimal context as a "sanity check". Third, because I may wish to write _logical operations_ in a manner polymorphic over my "bool-like" type. In the first two cases, the existing behaviour is fine. In the last case, it is a net positive.
I agree about the desire to abstract over lattices so we can write logic programs over generalized truth values. However, this is not what the Bits class gives us. Most of the operations explicitly assume we're working with bitvectors. Some of these operations (bit, setBit, clearBit,...) can be argued to make sense for any complete Boolean algebra, but doing so requires an arbitrary mapping between atoms and Int. Other operations (shift, rotate,...) don't make sense with arbitrary Int--atom mappings because they rely on an ordering of atoms (as given by the ordering of Int). Moreover, being intuitionists, if we were to codify lattices as a type class then we'd surely want to have a class for Heyting algebras, and then have Boolean algebras as a subclass. -- Live well, ~wren