[Haskell-cafe] Re: Double - CDouble, realToFrac doesn't work

2004-11-05 Thread Dylan Thurston
On Thu, Nov 04, 2004 at 08:32:52PM +0100, Sven Panne wrote: It's an old thread, but nothing has really happened yet, so I'd like to restate and expand the question: What should the behaviour of toRational, fromRational, and decodeFloat for NaN and +/-Infinity be? Even if the report is unclear

Re: [Haskell-cafe] Re: Double - CDouble, realToFrac doesn't work

2004-11-05 Thread MR K P SCHUPKE
I would be very careful of adding non-rationals to the Rational type. Why is there no Irrational class. This would make more sense for Floats and Doubles than the fraction based Rational class. We could also add an implementation of infinite precision irrationals using a pair of Integers for

Re: [Haskell-cafe] Re: Double - CDouble, realToFrac doesn't work

2004-11-05 Thread Robert Dockins
My guess is because irrationals can't be represented on a discrete computer (unless you consider a computaion, the limit of which is the irrational number in question). A single irrational might not just be arbitrarily long, but it may have an _infinite_ length representation! What you have

Re: [Haskell-cafe] Re: Double - CDouble, realToFrac doesn't work

2004-11-05 Thread Henning Thielemann
On Fri, 5 Nov 2004, Robert Dockins wrote: What IEEE has done is shoehorned in some values that aren't really numbers into their representation (NaN certainly; one could make a convincing argument that +Inf and -Inf aren't numbers). I wonder why Infinity has a sign in IEEE floating

[Haskell-cafe] Making MVar and Chan Instances of Typeable

2004-11-05 Thread Benjamin Franksen
Hello Experts, I need MVar and Chan to be instances of Typeable. Any hint on how this is most easily done would be greatly appreciated. I could change the libraries and add 'deriving Typeable' but I hesitate to do so. Cheers, Ben ___ Haskell-Cafe

Re: [Haskell-cafe] Re: Double - CDouble, realToFrac doesn't work

2004-11-05 Thread Ben Rudiak-Gould
Henning Thielemann wrote: I wonder why Infinity has a sign in IEEE floating processing, as well as 0. To support this behaviour uniformly one would need a +0 or -0 offset for each number, which would lead straightforward to non-standard analysis ... See Branch Cuts for Complex Elementary

Re: [Haskell-cafe] Re: Double - CDouble, realToFrac doesn't work

2004-11-05 Thread Benjamin Franksen
On Friday 05 November 2004 14:57, Henning Thielemann wrote: On Fri, 5 Nov 2004, Robert Dockins wrote: I wonder why Infinity has a sign in IEEE floating processing, as well as 0. As regards Inf, this makes sense, because with +Inf and -Inf order is preserved. With one unsigned Inf nothing is

Re: [Haskell-cafe] Making MVar and Chan Instances of Typeable

2004-11-05 Thread Tomasz Zielonka
On Fri, Nov 05, 2004 at 01:57:53PM +0100, Benjamin Franksen wrote: Hello Experts, I need MVar and Chan to be instances of Typeable. Any hint on how this is most easily done would be greatly appreciated. I could change the libraries and add 'deriving Typeable' but I hesitate to do so. The

Re: [Haskell-cafe] Re: Double - CDouble, realToFrac doesn't work

2004-11-05 Thread MR K P SCHUPKE
My guess is because irrationals can't be represented on a discrete computer Well, call it arbitrary precision floating point then. Having built in Integer support, it does seem odd only having Float/Double/Rational... Keean. .. ___

Re: [Haskell-cafe] Re: Double - CDouble, realToFrac doesn't work

2004-11-05 Thread Duncan Coutts
On Fri, 2004-11-05 at 13:57, Henning Thielemann wrote: On Fri, 5 Nov 2004, Robert Dockins wrote: What IEEE has done is shoehorned in some values that aren't really numbers into their representation (NaN certainly; one could make a convincing argument that +Inf and -Inf aren't numbers).

Re: [Haskell-cafe] Re: Double - CDouble, realToFrac doesn't work

2004-11-05 Thread Benjamin Franksen
On Friday 05 November 2004 14:11, you wrote: It's worse: Since according to IEEE +0 is not equal to -0, atan2 is not a function! Sorry, I meant to write: Since according to IEEE +0 *is* to be regarded as equal to -0, atan2 is not a function. (Because it gives different values for argument

Re: [Haskell-cafe] Making MVar and Chan Instances of Typeable

2004-11-05 Thread Benjamin Franksen
On Friday 05 November 2004 15:51, you wrote: On Fri, Nov 05, 2004 at 01:57:53PM +0100, Benjamin Franksen wrote: Hello Experts, I need MVar and Chan to be instances of Typeable. Any hint on how this is most easily done would be greatly appreciated. I could change the libraries and add

Re: [Haskell-cafe] Making MVar and Chan Instances of Typeable

2004-11-05 Thread MR K P SCHUPKE
nstance Typeable a = Typeable (MVar a) where typeOf (x::x) = mkAppTy (mkTyCon Control.Concurrent.MVar.MVar) [typeOf (undefined::x)] Keean. ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: Double - CDouble, realToFrac doesn't work

2004-11-05 Thread Robert Dockins
[...] Thus (a-b) is not the same as -(b-a) for IEEE floats! Nor is x*0 equal to 0 for every x; nor does x == y imply f(x) == f(y) for every x, y, f; nor is addition or multiplication associative. There aren't many identities that do hold of floating point numbers. Yes, but they DO hold for

Re: [Haskell-cafe] Re: Double - CDouble, realToFrac doesn't work

2004-11-05 Thread Marcin 'Qrczak' Kowalczyk
Benjamin Franksen [EMAIL PROTECTED] writes: It's worse: Since according to IEEE +0 is not equal to -0, atan2 is not a function! Sorry, I meant to write: Since according to IEEE +0 *is* to be regarded as equal to -0, atan2 is not a function. (Because it gives different values for argument

Re: [Haskell-cafe] Making MVar and Chan Instances of Typeable

2004-11-05 Thread Benjamin Franksen
On Friday 05 November 2004 16:20, MR K P SCHUPKE wrote: nstance Typeable a = Typeable (MVar a) where typeOf (x::x) = mkAppTy (mkTyCon Control.Concurrent.MVar.MVar) [typeOf (undefined::x)] I may be missing something but this look like an open recursion to me. The type 'x' is 'MVar a',

Re: [Haskell-cafe] Making MVar and Chan Instances of Typeable

2004-11-05 Thread Benjamin Franksen
On Friday 05 November 2004 13:57, Benjamin Franksen wrote: Hello Experts, I need MVar and Chan to be instances of Typeable. Any hint on how this is most easily done would be greatly appreciated. I could change the libraries and add 'deriving Typeable' but I hesitate to do so. Ok, I found a

Re: [Haskell-cafe] Making MVar and Chan Instances of Typeable

2004-11-05 Thread Koji Nakahara
On Fri, 5 Nov 2004 14:43:55 +0100 Benjamin Franksen [EMAIL PROTECTED] wrote: snip the instances by hand. My first attempt was: instance Typeable a = Typeable (MVar a) where typeOf x = mkAppTy (mkTyCon Control.Concurrent.MVar.MVar) [typeOf (undefined::a)] but unfortunately this

Re: [Haskell-cafe] Making MVar and Chan Instances of Typeable

2004-11-05 Thread MR K P SCHUPKE
My mistake: instance Typeable a = Typeable (MVar a) where typeOf (x::MVar x) = mkAppTy (mkTyCon Control.Concurrent.MVar.MVar) [typeOf (undefined::x)] Keean. ___ Haskell-Cafe mailing list [EMAIL PROTECTED]

Re: [Haskell-cafe] Making MVar and Chan Instances of Typeable

2004-11-05 Thread Benjamin Franksen
On Friday 05 November 2004 15:07, Benjamin Franksen wrote: instance Typeable a = Typeable (MVar a) where typeOf x = mkAppTy (mkTyCon Control.Concurrent.MVar.MVar) [typeOf y] where y = unsafePerformIO $ do z - newEmptyMVar = readMVar return (z `asTypeOf` x)

[Haskell-cafe] Literate Haskell and piecewise construction of classes/instances

2004-11-05 Thread Graham Klyne
I'm experimenting with a Literate Haskell style to construct a tutorial about Description Logics [1][2]. I'm developing the material in small sections, and using examples in the document to test the code as I go along . I therefore find that I want to introduce the components of class and

Re: [Haskell-cafe] Re: Double - CDouble, realToFrac doesn't work

2004-11-05 Thread Dylan Thurston
On Fri, Nov 05, 2004 at 02:53:01PM +, MR K P SCHUPKE wrote: My guess is because irrationals can't be represented on a discrete computer Well, call it arbitrary precision floating point then. Having built in Integer support, it does seem odd only having Float/Double/Rational... There are

[Haskell-cafe] Defining Haskell using arrows

2004-11-05 Thread Andy Elvey
Hi all - I'm a first-timer here, and am *very* much attracted by Haskell's elegance and power ... :-) I have only poked around briefly with Haskell so far (at the hello world level). One thing that I have come across, and which really got me thinking, was the page on the Haskell

Re: [Haskell-cafe] Making MVar and Chan Instances of Typeable

2004-11-05 Thread Remi Turk
On Fri, Nov 05, 2004 at 01:57:53PM +0100, Benjamin Franksen wrote: Hello Experts, I need MVar and Chan to be instances of Typeable. Any hint on how this is most easily done would be greatly appreciated. I could change the libraries and add 'deriving Typeable' but I hesitate to do so.

[Haskell-cafe] (Re arrows and Haskell) ...

2004-11-05 Thread Andy Elvey
Hi again - Apologies for another post from me so soon (and for replying to my own post). Regarding my post about arrows and Haskell (and the idea of trying to define Haskell's grammar in terms of arrows) - upon thinking about that, I'm pretty much of the opinion that it'd be an