[Haskell-cafe] Re: Global variables again

2004-11-23 Thread Benjamin Franksen
[we should really keep this on haskell-cafe because such lengthy discussions are what the cafe is for] On Tuesday 23 November 2004 10:26, Adrian Hey wrote: On Monday 22 Nov 2004 4:03 pm, Benjamin Franksen wrote: This is getting ridiculous. At least two workable alternatives have been

[Haskell-cafe] Re: [Haskell] Top Level TWI's again

2004-11-23 Thread Benjamin Franksen
[for the third time moving this discussion to cafe] On Tuesday 23 November 2004 20:20, Aaron Denney wrote: [...about std file handles...] They're wrappers around the integers 0, 1, and 2. The handles could have been implemented to be the same, at each invocation. (I expect they are in most

Re: [Haskell-cafe] foldlWhile

2004-11-22 Thread Benjamin Franksen
On Saturday 20 November 2004 10:47, Serge D. Mechveliani wrote: Is such a function familia to the Haskell users? foldlWhile :: (a - b - a) - (a - Bool) - a - [b] - a Maybe this link is of interest to you: http://okmij.org/ftp/Haskell/#fold-stream Ben -- Top level things with identity are

Re: [Haskell-cafe] Re: Top Level TWI's again was Re: [Haskell] Re: Parameterized Show

2004-11-22 Thread Benjamin Franksen
On Monday 22 November 2004 23:22, Keean Schupke wrote: It seems to me that as unsafePerformIO is not in the standard and only implemented on some compilers/interpreters, that you limit the portability of code by using it, and that it is best avoided. Also as any safe use of unsafePerformIO

Re: [Haskell-cafe] Global Variables and =?utf-8?q?IO=09initializers?=

2004-11-08 Thread Benjamin Franksen
On Tuesday 09 November 2004 03:18, Ben Rudiak-Gould wrote: Adrian Hey's example of a badly-written C library is one. But I agree with Robert Dockins that such cases are better solved in C than in Haskell. Yes. Your code won't depend on compiler (dependent) flags to disable optimizations, which

[Haskell-cafe] Re: [Haskell] Re: Global Variables and IO initializers

2004-11-07 Thread Benjamin Franksen
On Sunday 07 November 2004 17:41, Keean wrote: I might really want to call the initialisation twice. If you use global variables, the library can only be initialised once... but what if I really want to use the library twice? With the state in a type passed between functions, you can have

[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 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] 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 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

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] Re: www.haskell.org - applications - HWS-WP

2004-11-02 Thread Benjamin Franksen
On Tuesday 02 November 2004 11:53, you wrote: Benjamin Franksen wrote: The Haskell Web Server with Plugins is not easily found if one only has the link to the sourceforge announcement. Maybe a link to the home page http://www.mdstud.chalmers.se/~md9ms/hws-wp/ would be nice? Cheers, Ben

Re: [Haskell-cafe] Newbie Question on type constructors

2004-11-01 Thread Benjamin Franksen
On Monday 01 November 2004 23:40, Jon Fairbairn wrote: if Circle.destruct:: Shape - (Double - t) - t - t and similarly Square.destruct, we'd just have to write the case as Circle.destruct s f (Square.destruct s g (error impossible)) ie the .destructs take a Shape, a function to apply if it

Re: [Haskell-cafe] Newbie Question on type constructors

2004-11-01 Thread Benjamin Franksen
On Monday 01 November 2004 23:48, Ben Rudiak-Gould wrote: Benjamin Franksen wrote: Because, hmmm, isn't it rather *one* destructor with type destructShape :: Shape - (Double - t) - (Double - t) - t where the second and third arguments explain what to do with a Circle resp

Re: [Haskell-cafe] readMVar and the devils

2004-07-06 Thread Benjamin Franksen
On Friday 02 July 2004 15:59, you wrote: at a guess the magic take put is: block ( do a - takeMVar x putMVar x a ) return a This doesn't prevent the race condition Conor mentioned. It only prevents the thread executing the above code from being interrupted by an asynchronous

Re: [Haskell-cafe] Join and it's relation to = and return

2004-06-10 Thread Benjamin Franksen
On Wednesday 09 June 2004 17:20, Ron de Bruijn wrote: --- Iavor S. Diatchki [EMAIL PROTECTED] wrote: Only I still find it weird that join is called a multiplication, because according to the definition of multiplication, there should be an inverse. I think, thus that multiplication is only

Re: [Haskell-cafe] Adding Ord constraint to instance Monad Set?

2004-03-31 Thread Benjamin Franksen
On Wednesday 31 March 2004 08:48, Wolfgang Jeltsch wrote: Am Mittwoch, 31. März 2004 03:11 schrieb Benjamin Franksen: instance Monad Set where m = k = concatSets (mapSet k m) return x = unitSet x fail s = emptySet concatSets sets = foldl union emptySet

Re: [Haskell-cafe] Adding Ord constraint to instance Monad Set?

2004-03-30 Thread Benjamin Franksen
On Wednesday 31 March 2004 00:11, S. Alexander Jacobson wrote: Following the declaration of instance Monad [] in the prelude, and puzzling over the absence of its equivalent from Data.Set, I naively typed: instance Monad Set where m = k = concatSets (mapSet k m) return x =

<    1   2   3