> class Bits b => FiniteBits b where
> finiteBitSize :: b -> Int
> finiteBitSize = bitSize
The former permits safer access to bitSize while allowing applications that can deal with infinite structures to run, the latter permits safer access to bitSize while allowing applications that cannot deal with infinite structures to know that they aren't dealing with Integer or somebody's Natural data type.
-Edward
On Wed, Aug 22, 2012 at 5:19 PM, Ian Lynagh
<ian@well-typed.com> wrote:
On Mon, Aug 13, 2012 at 06:42:54PM -0400, Edward Kmett wrote:
>
> class Bits b where
> perhapsBitSize :: b -> Maybe Int
> ...
>
> I am not wedded to the perhapsBitSize name
I've lost track of where this proposal is, but if we do end up with a
Maybe function then I think it should be called maybeBitSize or
bitSizeMaybe. The only analogous example in the core libraries that I
can think of OTTOMH is Text.Read.readMaybe.
Thanks
IAn