
9 May
2009
9 May
'09
2:30 a.m.
Neil Mitchell wrote:
[...]
Which is a shame, having Bits on Bool seems entirely logical, having Num a superclass of Bits seems a little less clear.
There are two default implementations in Bits bit i = 1 `shiftL` i x `testBit` i = (x .&. bit i) /= 0 which rely on Num (and on the fact that 0 ~= 0..0 and 1 ~= 0..01, which doesn't have to be the case in all Num instances?). But is that worth having Num as superclass? When declaring in instance for Bits you have to implement at least 8 functions anyway so these two IMHO don't really make a difference, do they? //Stephan -- Früher hieß es ja: Ich denke, also bin ich. Heute weiß man: Es geht auch so. - Dieter Nuhr