
15 Oct
2011
15 Oct
'11
8:50 p.m.
On 16 October 2011 02:41, John Meacham
Or even worse,
if 3 then True else False would result in 'False' since 3 /= true (1) or 'True' since 3 /= false (0)
neither is obvious.
For a C programmer the latter would be obvious. But we're not C programmers...
Adding just zero and one doesn't completely solve the problem, because testBit uses equality with zero, so an Eq instance is needed.
Yes but the Bits class already has Eq as a superclass. This proposal only deals with removing the Num superclass. Bas P.S. Slight correction for my previous message: These would be better definitions of .&. and .|.: x .&. y = ifThenElse x y false x .|. y = ifThenElse x true y since these have the same strictness properties as (&&) and (||).