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:54:32 UTC 2014

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

> Yes, the differing opinions make the newtype introduction appealing, but
> if Bits is eventually made lazier to support generalized short-circuiting,
> will this then be a wart there? I've really liked a lot of the points I've
> seen from both sides of this debate, so it'd be great to navigate the
> branchy vs branchless crossroads with a bit of style.

I think the point is that this exactly addresses that: people who want the
spine strictness of the existing Bits instances get it for Bool via the
newtype and corresponding strict Bits instance (and maybe other instances),
people who want laziness get it via Bool --- and this also advances the
cause of generalizing existing Bool-related things, since the next obvious
thing to do is make it possible to use && and || on a typeclass instead of
hardcoded for Bool, so they can be extended to Bit.

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