Proposal: Add hasBitSize to Data.Bits.Bits

Henning Thielemann lemming at henning-thielemann.de
Mon Aug 13 19:13:08 CEST 2012


On Sun, 29 Jul 2012, Thomas Schilling wrote:

> On 29 July 2012 15:37, Thomas DuBuisson <thomas.dubuisson at gmail.com> wrote:
>>
>> That is a great point.  Most my uses of 'bitSize' are monomorphic and
>> Maybe would just be silly.  OTOH, I'd be more than happy to fix up any
>> polymorphic code to include a new BitSize constraint.
>
> To make sure I understand this correctly:
>
> The current problem is that bitSize is a partial function *depending
> on the type* of its argument (currently it always returns _|_ for
> Integer, and is total for any other type). That does indeed seem like
> a Bad Idea.
>
> You propose to:
>
>  1. Remove "bitSize" from the Bits class.
>  2. Add a new class BitSize which only contains the "bitSize" method.
> Integer would not be an instance of this class.

+1



More information about the Libraries mailing list