Improve documentation for Real

David Feuer david.feuer at gmail.com
Thu Dec 24 02:46:29 UTC 2020


Wouldn't it make more sense to get at the idea from another direction or
two? One obvious idea is to compare to a rational number:

    compareRational :: a -> Rational -> Ordering

Neither this nor Ord can be supported by computable reals, so maybe there
should be a superclass for numbers that can be *approximated by* rationals
to an arbitrary precise degree.

On Wed, Dec 23, 2020, 8:06 PM David Feuer <david.feuer at gmail.com> wrote:

> Perhaps that's the answer, but it seems frankly bizarre to call a class
> Real if `Real s` actually means that `s` is a subset of the rational
> numbers.
>
> On Wed, Dec 23, 2020, 8:02 PM Henning Thielemann <
> lemming at henning-thielemann.de> wrote:
>
>>
>> On Wed, 23 Dec 2020, David Feuer wrote:
>>
>> > The Real class has one method:
>> > -- | the rational equivalent of its real argument with full precision
>> >
>> > toRational :: a -> Rational
>> >
>> > This is ... pretty weird. What does "full precision" mean? For integral
>> and floating point types, it's fine. It's
>> > not at all meaningful for
>> >
>> > 1. Computable reals
>> > 2. Real algebraic numbers
>> > 3. Real numbers expressible in radicals
>> > 4. Rational numbers augmented with some extra numbers like pi
>> > 5. Geometrically constructable reals
>> > 6. Etc.
>>
>> They cannot have Real instances, then. Right?
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20201223/95ede787/attachment.html>


More information about the Libraries mailing list