[Haskell-cafe] Why is Bool no instance of Num and Bits?
john at repetae.net
Wed Jun 24 08:13:06 EDT 2009
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 Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/
More information about the Haskell-Cafe