Proposal: add `Proxy`fied versions of `bitSizeMaybe` and `finiteBitSize`

Henning Thielemann lemming at henning-thielemann.de
Thu Dec 14 08:43:57 UTC 2017


On Wed, 13 Dec 2017, M Farkas-Dyck wrote:

> I propose to add the following methods to `Bits` and `FiniteBits` classes:
>
> class Bits a where
>     ...
>
>     bitSizeMaybe' :: Proxy a -> Maybe Int
>
> class FiniteBits b where
>     ...
>
>     finiteBitSize' :: Proxy b -> Int

Alternative suggestion for names (I frequently overlook the primes):
    bitSizeMaybeConst :: Const (Maybe Int) a
    finiteBitSizeConst :: Const Int a
    sizeOfConst :: Const Int a
    alignmentConst :: Const Int a

Then we must add mutual default implementations in order to preserve 
existing instances.


More information about the Libraries mailing list