Removing bitSize
Henning Thielemann
lemming at henning-thielemann.de
Tue Jul 11 13:38:24 UTC 2017
On Mon, 10 Jul 2017, David Feuer wrote:
> The long-deprecated bitSize method of the Bits class is slated to be
> removed in base-4.11 (GHC 8.4). There is one remaining question:
> should we replace it with a *function* by that name with a FiniteBits
> constraint? I don't feel very strongly either way, but Ryan Scott
> seems in favor and Edward Kmett seems opposed. So it seems best to
> bring it to the libraries list and let the CLC make the call. If the
> function is added, it would look like this:
>
> bitSize :: FiniteBits a => a -> Int
> bitSize = finiteBitSize
I'd like to have a solution that allows me to make my code compilable by
many GHC versions. The top-level function with an almost identical
signature seems to fit that requirement best. The solutions using Proxy,
Tagged, and TypeApplication are nice, too, but since there are many
sensible choices there might also be many functions like bitSizeProxy,
bitSizeTagged, bitSizeTypeApp.
More information about the Libraries
mailing list