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

David Feuer david.feuer at
Sun Sep 28 20:07:44 UTC 2014

On Sep 28, 2014 3:14 PM, "Edward Kmett" <ekmett at> wrote:
> Too many small changes would have to go in, and you'd need at least one
factoring of the Bits class to make it compelling.
> A fully consistent version of it would be to adopt short-circuiting
across all Bits instances (ugh), factor out testBit somehow, then consider
> If testBit didn't exist in the class
> In a world where the current proposal does come to fruition, such a class
would be a separate ad hoc construction, and well, frankly that just would
probably never happen.

Yes, it would be a separate construction. It would not be any more "ad hoc"
than anything else, and could well be cleaner than some. If you formulated
it and proposed it as an addition to base, I bet you'd win a lot of
agreement. It seems a lot harder *and uglier* to hack Bits to do that too.
You already have &&, ||, and not available to push into it. That said,
isn't some of what you're talking about already possible (and less
confusing) if you just do a little explicit lifting?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list