Proposol: make Data.Bits algebraic

Johnson-Freyd, Philip Alden pajohn at sandia.gov
Mon Mar 11 21:49:14 UTC 2019


Hello,

The current version of Data.Bits is non-algebraic, in so far as the Bits class has
1. a superclass constraint on `Eq`
2. operations `testBit` and `isSigned` which return `Bool`.

This is quite annoying, as myriad potential uses of the Bits class cover types for which these concrete observations are not possible. It leads to comments like the following in SBV:

-- | This instance is only defined so that we can define an instance for
-- 'Data.Bits.Bits'. '==' and '/=' simply throw an error. Use
-- 'Data.SBV.EqSymbolic' instead.

We had this same issue for `Num` for years, until it eventually got fixed. And it would be nice to fix the situation for `Bits` as well.

There are other aspects of the Bits API which are pretty clunky, but this is the one that is often a show stopper.

Philip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20190311/a0acc0a0/attachment.html>


More information about the Libraries mailing list