proposal/RFC: add bSwap to base in Data.Bits

Edward Kmett ekmett at
Thu May 16 10:32:41 CEST 2013

I would be strongly against naming it 'swap'. Lots of people in the
community do not subscribe to the philosophy that all things should be
imported qualified.

'byteSwap' or even 'byteswap' would be closer to the traditional 'bswap'
name in spirit.


On Thu, May 16, 2013 at 4:24 AM, Henning Thielemann <
lemming at> wrote:

> On Thu, 16 May 2013, Vincent Hanquez wrote:
>  I'm trying to expose some byte swapping (bSwap) capabilities in base,
>> namely
>> operation to allow to swap endianness on word{16,32,64}, i.e.:
>>  bswap16 :: Word16 -> Word16
>>  bswap16 a = (a `shiftR` 8) .|. (a `shiftL` 8)
>>  ...
> If at all, I'd suggest a name without the 'b', since the other functions
> like 'shift' do not contain a 'b' as well. You can use qualification if you
> want to say that the swap is meant with respect to 'bits'.
> ______________________________**_________________
> Libraries mailing list
> Libraries at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list