Default implementation of bitSize

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Default implementation of bitSize

Andrew Martin
The bitSize typeclass method has been deprecated since 4.7. However, library author still have to implement it to avoid a warning. I propose that a default implementation using bitSizeMaybe be added. It would look like this:

    bitSize x = case bitSizeMaybe x of
      Nothing -> error "bitSize is deprecated and the type in question does not have a finite bit size"
      Just a -> a

--
-Andrew Thaddeus Martin

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Default implementation of bitSize

David Feuer
The usual next step after a method being deprecated is for it to be
removed. Can we remove it now? Or do we have to wait another cycle?

David

On Mon, Jan 9, 2017 at 8:29 AM, Andrew Martin <[hidden email]> wrote:

> The bitSize typeclass method has been deprecated since 4.7. However, library
> author still have to implement it to avoid a warning. I propose that a
> default implementation using bitSizeMaybe be added. It would look like this:
>
>     bitSize x = case bitSizeMaybe x of
>       Nothing -> error "bitSize is deprecated and the type in question does
> not have a finite bit size"
>       Just a -> a
>
> --
> -Andrew Thaddeus Martin
>
> _______________________________________________
> Libraries mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries