[Haskell-cafe] Why is Bool no instance of Num and Bits?
Andrew Wagner
wagner.andrew at gmail.com
Fri May 8 11:53:53 EDT 2009
Hmm, I never knew that. Is that a GHC thing? Is it strictly necessary? Seems
like it could be done in the Num instance for Integers, Ints, etc.
On Fri, May 8, 2009 at 11:51 AM, Neil Mitchell <ndmitchell at gmail.com> wrote:
> > Err, I'm not seeing the danger of this
> > (+) :: forall a. (Num a) => a -> a -> a
> > Doesn't this require the two parameters to be the same instance of Num?
>
> I didn't at first, then I remembered:
>
> 1 + True
> =
> fromInteger 1 + True
>
> And if we have Num for Bool, it type checks.
>
> Thanks
>
> Neil
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090508/21d16fdf/attachment.htm
More information about the Haskell-Cafe
mailing list