[Mid-discussion Summary] Proposal: add new Data.Bits.Bits(bitZero) method

Anthony Cowley acowley at seas.upenn.edu
Sat Feb 22 19:51:24 UTC 2014


I am -1 on the name zero. I don't think importing Data.Bits unqualified is uncommon at all, and zero is prime naming real estate. I am +0.5 on the addition overall, as most uses of Bits are with types that also have Num instances. If we are naming this thing, then I vote for zeroBits.

Anthony

> On Feb 22, 2014, at 5:03 AM, Herbert Valerio Riedel <hvr at gnu.org> wrote:
> 
> Hello *,
> 
> Here's a mid-discussion summary of the proposal
> 
>>> Introduce a new class method
>>> 
>>>  class Bits a where
>>>      ...
>>>      -- | Value with all bits cleared
>>>      <0-value-method> :: a
>>>      ...
>>> 
>>> modulo naming of '<0-value-method>'
> 
> from my point of view:
> 
> - The idea came up already in 2011 when Num-superclass was to be removed from Bits
>   (but discussion derailed)
> 
> - So far general consensus (i.e. no "-1"s afaics) it's desired to have
>   an all-bits-clear value introducing method in 'Bits'
> 
> - Use "clearBit (bit 0) 0" as default implementation for smooth upgrade-path
> 
> - Nameing for <0-value-method> boils down to two candidates:
> 
>    a) 'Data.Bits.zero'
> 
>        - based on the idea tha 'Data.Bits' ought to be imported
>          qualified (or with explicit import-list) anyway
>          (-> thus following PVP practice)
> 
>        - many existing Data.Bits.Bits methods such as 'rotate',
>          'complement', 'popCount', 'xor', or 'shift' don't have
>          the name 'bit' in it (and those few that have, operate
>          on single bits)
> 
>        - supporters (in no particular order):
> 
>           - ARJANEN Loïc Jean David
>           - Henning Thielemann
>           - Herbert Valerio Riedel (+0.99)
>           - Twan van Laarhoven
> 
>    b) 'Data.Bits.zeroBits'
> 
>        - more verbose name reduces risk of namespace conflicts with unqualified imports
> 
>        - supporters (in no particular order):
> 
>           - Edward Kmett
>           - Eric Mertens
>           - Herbert Valerio Riedel
>           - Twan van Laarhoven
>           - (maybe?) ARJANEN Loïc Jean David
> 
> 
>    So far there doesn't seem to be a very clear preference for
>    'zeroBits' over 'zero'. It might help, if those how expressed some
>    kind of support for both variants could clarify if their preference
>    has any bias towards 'zeroBits' or 'zero'.
> 
> 
> Cheers,
>   hvr
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries


More information about the Libraries mailing list