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

Brandon Allbery allbery.b at gmail.com
Sun Sep 28 20:03:10 UTC 2014


On Sun, Sep 28, 2014 at 2:45 PM, David Feuer <david.feuer at gmail.com> wrote:

> I would think what you're trying to do would likely be better with a
> different class, by another name, supporting things like .&&., .||., etc.,
> or maybe even moving && and || into a class.


So, if I look at this from the angle that the strictness of other Bits
instances is an artifact of their being spine-strict bit vectors, I get
that the correct answer to this is not a new class but a "strict" newtype
on Bool. The standard lazy Bool is by far the more common one, so it's the
strict variant that gets the newtype. (Compare the Sum and Product monoid
newtype-s.)

-- 
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/20140928/9101a64c/attachment.html>


More information about the Libraries mailing list