Proposal: change the Bits instance for Bool to align with other basic types and support branchless calculations

Brandon Allbery allbery.b at
Mon Sep 29 16:39:59 UTC 2014

On Mon, Sep 29, 2014 at 12:32 PM, Anthony Cowley <acowley at>

> Part of what distinguishes Bits here is specifically what we're
> discussing. There is some level of agreement that there should be a
> non-short-circuiting operation on Bool somewhere, and the proposal points
> out that such a thing fits into Bits quite well because it is consistent
> with other Bits instances. It happens that this also suits my intuition
> about the use of bitwise operations, and that turning to Bits suggests that
> the programmer is digging a bit deeper into a representation than is
> perhaps usual. Since different folks have different intuitions, however, I
> think a vote is the only useful way forward.

Maybe I should just formally propose

    newtype Bit = Bit { unBit :: Bool }

with the appropriate derived instances, and a strict Bits instance. The
distinction between Bit and Bool also seems to fit my intuitions.

brandon s allbery kf8nh                               sine nomine associates
allbery.b at                                  ballbery at
unix, openafs, kerberos, infrastructure, xmonad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list