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 19:38:26 UTC 2014


On Sun, Sep 28, 2014 at 3:20 PM, Brandon Allbery <allbery.b at gmail.com>
wrote:

> On Sun, Sep 28, 2014 at 3:14 PM, Edward Kmett <ekmett at gmail.com> wrote:
>
>> But since you insist on trying to force me to provide a fully concrete
>> realization of a counter-proposal
>
>
> Well, no. I, and apparently dfeuer, are missing something; I'm trying to
> figure out what it is. So I don't want a fleshed-out counter-proposal, just
> pointers to whatever it is that's not at all obvious to us.
>

Unpacking this a bit more:

I fully admit to not being in my element when it comes to things like this.
I also have this feeling (which may well be a heuristic that is
inappropriate in this case) that, when someone proposes something that
sounds like it's specific to a particular instance of a typeclass as
belonging in the typeclass itself, something's wrong somewhere. In
particular, I'm not quite seeing where this fits within Data.Bits.

Now, it may well be that there is some algebra somewhere that makes what
I'm seeing a good generalization to all of Data.Bits (and the fact that
you're proposing it makes it seem more likely; sadly, it also makes it more
likely that it'll soar well over my head...). Flip side, it may be that the
use case is compelling enough to justify making the Bool instance
"different" from the other Data.Bits instances. Or some other possibility
I'm completely missing.

Under normal circumstances I'd probably just accept that this is something
over my pay grade --- but it seems dfeuer is tripping over the same
confusion? So I'm trying to figure out how to get at the part that's not
coming together in all of this, that would make it look less like
abuse-of-typeclass and more an expression of a mathematical consonance on
some level.

-- 
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/3b2dd6ac/attachment-0001.html>


More information about the Libraries mailing list