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

Daniel Fischer daniel.is.fischer at web.de
Fri May 8 14:49:19 EDT 2009


Am Freitag 08 Mai 2009 19:18:37 schrieb Brandon S. Allbery KF8NH:
> On May 8, 2009, at 12:00 , Neil Brown wrote:
> > If you change fromInteger in Num Bool to be fromInteger x = x /= 0,
> > then we could all start writing nasty C-like if-expressions...
>
> I'd be strongly tempted to say
>
>  > fromInteger = const False

fromInteger _ = unsafePerformIO $ randomRIO (False,True)

looks safer to me.


More information about the Haskell-Cafe mailing list