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

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


On Mon, Sep 29, 2014 at 12:32 PM, Anthony Cowley <acowley at seas.upenn.edu>
wrote:

> 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 gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140929/94496a62/attachment.html>


More information about the Libraries mailing list