Proposol: make Data.Bits algebraic

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


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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list