[Haskell-beginners] beginner's type error

Ivan Moore ivan.r.moore at gmail.com
Thu Apr 2 05:46:29 EDT 2009


without engaging my brain too much, given what you've said, then why
is "10" both integral and floating point? why not "10" being integral
and "10.0" being floating point?

On Tue, Mar 31, 2009 at 2:09 AM, Jason Dusek <jason.dusek at gmail.com> wrote:
> 2009/03/27 Ivan Moore <ivan.r.moore at gmail.com>:
>> > The reason (which is a bit confusing) is that it typechecks
>> > just fine---if there *were* a type which is an instance of
>> > both Integral and Floating (and I guess round needs RealFrac
>> > as well), n could have that type.  There isn't such a type
>> > in the standard libraries, but in theory you could make up
>> > your own type which is an instance of both.
>>
>> If there were such a type, could "10" have that type and then
>> would my problem have not existed?
>
>  Yes, that is correct.
>
>> in which case, why doesn't it!?
>
>  Does it actually make any logical sense for a type to be both
>  integral (governed by rules of modular division) and floating
>  point (governed by rules of IEEE 754 division)?
>
> --
> Jason Dusek
>


More information about the Beginners mailing list