[Haskell-cafe] Why is Bool no instance of Num and Bits?
wagner.andrew at gmail.com
Fri May 8 11:49:41 EDT 2009
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?
On Fri, May 8, 2009 at 10:51 AM, Sittampalam, Ganesh <
ganesh.sittampalam at credit-suisse.com> wrote:
> Stephan Friedrichs wrote:
> > When looking for an xor function, I found one in Data.Bits but
> > couldn't use it for Bool, because Bool is no instance of Bits and of
> > Num (which would be necessary, because it's "class (Num b) => Bits
> > b"). My question is: Why not?
> > [...]
> > quite trivial... Why is this not part of base? Or am I missing
> > something?
> One reason would be that we don't want 1 + True to typecheck, even if it
> does have a sensible interpretation.
> Please access the attached hyperlink for an important electronic
> communications disclaimer:
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe