[Haskell-cafe] Why is Bool no instance of Num and Bits?

Sittampalam, Ganesh ganesh.sittampalam at credit-suisse.com
Fri May 8 10:51:32 EDT 2009

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?  
> [...]
> quite trivial... Why is this not part of base? Or am I missing
> something? 

One reason would be that we don't want 1 + True to typecheck, even if it
does have a sensible interpretation.


 Please access the attached hyperlink for an important electronic communications disclaimer: 

More information about the Haskell-Cafe mailing list