Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread Henning Thielemann
On Thu, 5 Aug 2010, Ivan Lazar Miljenovic wrote: On 5 August 2010 10:15, Lennart Augustsson lenn...@augustsson.net wrote: You're right.  It's bad to have toRational in Real.  It's also bad to have Show and Eq as superclasses to Num. I understand why it's bad to have Show as a superclass,

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread Henning Thielemann
On Wed, 4 Aug 2010, John Meacham wrote: The numeric classes are sort of messed up when it comes to non integral values. (not that they are perfect for other things) for instance, realToFrac doesn't preserve NaN or Infinity, Why should realToFrac do this? NaN, Infinity and +/-0 are IEEE

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread David Virebayre
On Thu, Aug 5, 2010 at 11:35 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: What else shall a rounding function return if not integers? Getting from 29.84645 to 29.85 isn't rounding ? David. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread Ivan Lazar Miljenovic
Henning Thielemann lemm...@henning-thielemann.de writes: On Wed, 4 Aug 2010, John Meacham wrote: and the rounding functions discard information too by trying to convert a floating point value to an integral one... What else shall a rounding function return if not integers? Some people may

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread Alexey Khudyakov
On 05.08.2010 13:35, Henning Thielemann wrote: On Wed, 4 Aug 2010, John Meacham wrote: The numeric classes are sort of messed up when it comes to non integral values. (not that they are perfect for other things) for instance, realToFrac doesn't preserve NaN or Infinity, Why should

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread Ivan Lazar Miljenovic
David Virebayre dav.vire+hask...@gmail.com writes: On Thu, Aug 5, 2010 at 11:35 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: What else shall a rounding function return if not integers? Getting from 29.84645 to 29.85 isn't rounding ? Yes it is:

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread Lennart Augustsson
Yes, for instance to be able to use functions as number. Or to be able to use constructive real numbers as numbers, since equality is not computable. -- Lennart On Thu, Aug 5, 2010 at 4:17 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 5 August 2010 10:15, Lennart Augustsson

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread Henning Thielemann
On Thu, 5 Aug 2010, David Virebayre wrote: On Thu, Aug 5, 2010 at 11:35 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: What else shall a rounding function return if not integers? Getting from 29.84645 to 29.85 isn't rounding ? Sure, it is, I missed that. Maybe such rounding

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread John Meacham
On Thu, Aug 05, 2010 at 11:35:04AM +0200, Henning Thielemann wrote: Why should realToFrac do this? NaN, Infinity and +/-0 are IEEE hacks for the common numerical applications you do with floating point numbers. These special values could be supported by floating point specific, or even

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread David Virebayre
On Thu, Aug 5, 2010 at 1:11 PM, John Meacham j...@repetae.net wrote: use. This isn't to say ghc is doing the wrong thing, I don't think there really is a right thing to do here given the broken class specifications in the report. I often read that the numerical classes are problematic. At the

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread Henning Thielemann
On Thu, 5 Aug 2010, David Virebayre wrote: On Thu, Aug 5, 2010 at 1:11 PM, John Meacham j...@repetae.net wrote: use. This isn't to say ghc is doing the wrong thing, I don't think there really is a right thing to do here given the broken class specifications in the report. I often read that

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread David Virebayre
On Thu, Aug 5, 2010 at 1:55 PM, Henning Thielemann lemm...@henning-thielemann.de wrote: It's even worse: The NumericPrelude is in progress, certainly currently better than Haskell 98's type classes, but there are known problems. Sometimes new numeric types are implemented and require to refine

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread Henning Thielemann
On Thu, 5 Aug 2010, David Virebayre wrote: It's sad because the class alias proposal was dropped from Haskell' two years ago, isn't it ? I don't know, but I think before an extension can go into Haskell' it should be at least implemented somewhere. (Is it implemented in JHC at all?)

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread malcolm.wallace
It's sad because the class alias proposal was dropped from Haskell' two years ago, isn't it ?Haskell' is an ongoing process of language revision. ClassAliases did not get into Haskell 2010, but it could certainly be adopted in 2011 or 2012, if there were consensus support for it. Usually,

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/5/10 05:47 , David Virebayre wrote: On Thu, Aug 5, 2010 at 11:35 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: What else shall a rounding function return if not integers? Getting from 29.84645 to 29.85 isn't rounding ? It is,

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-05 Thread wren ng thornton
Henning Thielemann wrote: On Wed, 4 Aug 2010, John Meacham wrote: The numeric classes are sort of messed up when it comes to non integral values. (not that they are perfect for other things) for instance, realToFrac doesn't preserve NaN or Infinity, Why should realToFrac do this? NaN,

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-04 Thread Alexander Solla
On Aug 4, 2010, at 11:30 AM, Omari Norman wrote: Why is toRational a method of Real? I thought that real numbers need not be rational, such as the square root of two. Wouldn't it make more sense to have some sort of Rational typeclass with this method? Thanks. You can't build the real

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-04 Thread Lennart Augustsson
You're right. It's bad to have toRational in Real. It's also bad to have Show and Eq as superclasses to Num. On Wed, Aug 4, 2010 at 8:30 PM, Omari Norman om...@smileystation.com wrote: Why is toRational a method of Real? I thought that real numbers need not be rational, such as the square

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-04 Thread John Meacham
On Wed, Aug 04, 2010 at 02:30:10PM -0400, Omari Norman wrote: Why is toRational a method of Real? I thought that real numbers need not be rational, such as the square root of two. Wouldn't it make more sense to have some sort of Rational typeclass with this method? Thanks. The numeric classes

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-04 Thread ok
Why is toRational a method of Real? I thought that real numbers need not be rational, such as the square root of two. Wouldn't it make more sense to have some sort of Rational typeclass with this method? I think everyone has problems with the Haskell numeric typeclasses. The answer in this

Re: [Haskell-cafe] Why is toRational a method of Real?

2010-08-04 Thread Ivan Lazar Miljenovic
On 5 August 2010 10:15, Lennart Augustsson lenn...@augustsson.net wrote: You're right.  It's bad to have toRational in Real.  It's also bad to have Show and Eq as superclasses to Num. I understand why it's bad to have Show as a superclass, but why Eq? Because it stops you from using functions