type classes and generality

Lennart Augustsson lennart@mail.augustsson.net
Mon, 09 Jul 2001 22:49:58 -0400

"Alexander V. Voinov" wrote:

> Hi All,
> Lennart Augustsson wrote:
> > > Each pseudorandom generator generates a countable sequence of values,
> > > which is isomorphic to a sequence of integers. In good old (Turbo)C we
> > > got something between 0 and MAXINT and then divided by (double)MAXINT.
> > > Can't _this_ be done in Haskell?
> >
> > Of course it can be done, but not in class Real, you have to be in Fractional.
> > I'm not sure why Real would be the class of choice for this problem anyway.
> > I'd think that Fractional or RealFrac would be more appropriate.
> I apologize for ignorance, I probably did not read this part of the doc
> attentively. But informally, the word 'Real' is widely used to denote a
> completely ordered field, and there is a theorem to change 'a' to 'the'.
> It's counterintuitive to use Real in any other meaning, I think.

I agree.

    -- Lennart