[Haskell-beginners] Help with types
Daniel Carrera
daniel.carrera at theingots.org
Thu Apr 23 10:25:25 EDT 2009
Thomas Davie wrote:
>> It looks like (/) is happy with Num but doesn't like Int. This
>> surprises me. I would have thought that Fractional is a kind of Num
>> and Int is a kind of Fractional
>
> Int isn't a Fractional because it can't represent fractional numbers.
Sure, but any integer is trivially also a fraction, so I would think
that it would be an acceptable input for (/). On the other hand, if it
is at all possible for a Num to contain something that cannot be
converted to a fraction, then a Num should not be a valid input for (/).
More information about the Beginners
mailing list