Proposal: Add hasBitSize to Data.Bits.Bits
Antoine Latter
aslatter at gmail.com
Sun Jul 29 18:38:54 CEST 2012
On Sun, Jul 29, 2012 at 11:37 AM, Antoine Latter <aslatter at gmail.com> wrote:
>
> The downside to this proposal is that the requester (Edward) actually
> wants a function of type "a -> Maybe Int", so his polymorphic function
> can handle both infinite bit-types and finite bit-types.
>
> With the new class, Edward could write:
>
> class BitTraversable i where
> traverseBits :: <sometype>
>
> instance (BitSize i) => BitTraversable i where
> traverseBits = <something>
>
> instance BitTraversable Integer where
> traverseBits = <something else>
>
I should add that this approach looks like it would require
OverlappingInstances.
Antoine
More information about the Libraries
mailing list