Agreed. I wound up having to add a horrible Num instance for Bool in 'monoids' in order to support a decent Boolean Ring type.
I would much rather be able to get rid of it!
The only problem with eliminating the constraint is that any code that uses Bits polymorphically might have to pick up a Num annotation, but I can't see it being a serious problem.
-Edward Kmett
On Wed, Jun 24, 2009 at 8:13 AM, John Meacham
<john@repetae.net> wrote:
On Fri, May 08, 2009 at 04:36:41PM +0200, Stephan Friedrichs wrote:
> When looking for an xor function, I found one in Data.Bits but couldn't
> use it for Bool, because Bool is no instance of Bits and of Num (which
> would be necessary, because it's "class (Num b) => Bits b"). My question
> is: Why not?
This has bothered me too. However, I think the root problem is that
'Num' is a superclass of 'Bits'. There is no reason it should be, all
the default instances can be specified without the Num dependency.
John
--
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/