Neil Mitchell wrote:
I didn't at first, then I remembered:

1 + True
=
fromInteger 1 + True

And if we have Num for Bool, it type checks.
Does that also mean that you could write:

if 3 - 4 then ... else ... (= if (fromInteger 3 :: Bool) - (fromInteger 4 :: Bool) then ... else ...)

or perhaps (not sure if type defaulting stretches to this):

if 1 then ... else ...  (= if (fromInteger 1 :: Bool) then ... else ...)

If you change fromInteger in Num Bool to be fromInteger x = x /= 0, then we could all start writing nasty C-like if-expressions...

Thanks,

Neil.


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to