Re: [Haskell-cafe] Go parallel

2007-11-06 Thread Lukas Mai
Am Dienstag, 6. November 2007 schrieb Andrew Coppin: Somebody correct me here - I was under the impression that you only ever need forkIO if you're doing something strange with FFI, and usually you just want fork? You're probably thinking of forkOS vs. forkIO. AFAIK there is no fork in

Re: [Haskell-cafe] Newbie question about tuples

2007-07-14 Thread Lukas Mai
Am Freitag, 13. Juli 2007 15:03 schrieb peterv: You see, in C++ I can write: [snip] So basically a wrapper around a fixed-size array of any length. Implementations of (+), (-), dot, length, normalize, etc... then work on vectors of any size, without the overhead of storing the size, and

Re: [Haskell-cafe] Newbie question about tuples

2007-07-13 Thread Lukas Mai
Am Donnerstag, 12. Juli 2007 20:14 schrieb Andrew Coppin: The only thing the libraries provide, as far as I can tell, is the fact that tuples are all Functors. (In other words, you can apply some function to all the elements to get a new tuple.) I think that's about it. I doubt you can use

Re: [Haskell-cafe] runInteractiveCommand and command not found

2007-07-07 Thread Lukas Mai
Am Samstag, 7. Juli 2007 11:27 schrieb Ketil Malde: I notice that when I try to execute a non-existing command with runInteractiveProcess, nasty things happen when I close the input. To be exact, the whole program terminates. Is this the intended behavior, and if so, what is the correct way

Re: [Haskell-cafe] interrupting an accept()ing thread

2007-07-07 Thread Lukas Mai
Am Freitag, 6. Juli 2007 01:24 schrieb Lukas Mai: Hello, cafe! I have the following code (paraphrased): ... forkIO spin ... spin = do (t, _) - accept s -- (*) forkIO $ dealWith t -- (**) spin My problem is that I want to stop spin from another thread. The obvious

Re: [Haskell-cafe] interrupting an accept()ing thread

2007-07-06 Thread Lukas Mai
Am Freitag, 6. Juli 2007 04:15 schrieb Thomas Conway: On 7/6/07, Lukas Mai [EMAIL PROTECTED] wrote: I don't see how this solves the problem. AFAICS acceptLoop never returns and sok is never closed. On the other hand, my program doesn't need a liveOpCount because the subthreads take care

[Haskell-cafe] interrupting an accept()ing thread

2007-07-05 Thread Lukas Mai
Hello, cafe! I have the following code (paraphrased): ... forkIO spin ... spin = do (t, _) - accept s -- (*) forkIO $ dealWith t -- (**) spin My problem is that I want to stop spin from another thread. The obvious solution would be to throw it an exception. However, that leaks a

Re: [Haskell-cafe] interrupting an accept()ing thread

2007-07-05 Thread Lukas Mai
Am Freitag, 6. Juli 2007 02:13 schrieb Thomas Conway: Here's my solution: acceptLoop sok reqChan = do req - Network.Socket.accept sok atomically (writeTChan reqChan req) acceptLoop sok reqChan mainLoop reqChan quitVar liveOpCountVar = do action - atomically (quitNow