Re: throwTo block statements considered harmful

2006-12-08 Thread Cat Dancer
The key problem is, at least in the presence of block/unblock, that Exceptions are never reliably delivered. Never? Even in a function which is in a blocking state? The implementation of asynchronous signals, as described by the paper Asynchronous exceptions in Haskell Simon Marlow,

Re: [Haskell-cafe] Re: How to combine Error and IO monads?

2006-12-08 Thread Cat Dancer
On 12/7/06, J. Garrett Morris [EMAIL PROTECTED] wrote: foo :: ErrorT String IO Int Since ErrorT String IO Int is not the same as IO, you can't use IO operations directly. In this case, you want: a - lift getLine You want: r - runErrorT foo Wow! I found your help terrific!

Re: [Haskell] Network accept loop with graceful shutdown implementation

2006-12-07 Thread Cat Dancer
On 12/7/06, Chris Kuklewicz [EMAIL PROTECTED] wrote: Could you add info about where to get your code (or the code) itself to the wiki at http://haskell.org/haskellwiki/Concurrency_demos/Graceful_exit ? OK, I did. unblock yield is the right code for a safepoint Be careful. You are relying

[Haskell-cafe] How to combine Error and IO monads?

2006-12-07 Thread Cat Dancer
I've read Jeff Newbern's tutorial on monad transformers (http://www.nomaware.com/monads/html/index.html), but I don't grok it yet and I can't tell how to get started with this particular requirement, or even if I need monad transformers for this. I have a program that performs a series of IO

Re: [Haskell-cafe] Re: How to combine Error and IO monads?

2006-12-07 Thread Cat Dancer
And you just rediscovered monad transformers. Can I use an existing monad transformer like ErrorT for this application? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: How to combine Error and IO monads?

2006-12-07 Thread Cat Dancer
On 12/7/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Cat Dancer wrote: I have a program that performs a series of IO operations, each which can result in an error or a value. If a step returns a value I usually want to pass that value on to the next step, if I get an error I want to do

'accept' behavior with an asynchronous exception inside of a 'block'

2006-12-06 Thread Cat Dancer
Chris Kuklewicz suggested I direct this question to the developers ^_^ If I use a network accept inside a block: block ( ... (clientSocket, sockAddr) - accept serverSocket ... ) and the 'accept' unblocks a pending asynchronous exception and the exception gets thrown, does this

[Haskell] Network accept loop with graceful shutdown implementation

2006-12-06 Thread Cat Dancer
I have a prospective implementation of a network accept loop with graceful shutdown. This email builds upon the previous discussion Help needed interrupting accepting a network connection. In this code, just the accept loop part has been factored out and put into its own module. My hope is

[Haskell] What guarantees (if any) do interruptible operations have in presence of asynchronous exceptions?

2006-12-05 Thread Cat Dancer
From the discussion of Help needed interrupting accepting a network connection, what we have so far is: * To break out of an accept call, an asynchronous exception is needed. * The presence of asynchronous exceptions complicates the other code used to report if accept completed or

Re: [Haskell] What guarantees (if any) do interruptible operations have in presence of asynchronous exceptions?

2006-12-05 Thread Cat Dancer
On 12/5/06, Chris Kuklewicz [EMAIL PROTECTED] wrote: Making small programs to test these properties is a good sanity check. For instance I just leaned that safePoint = unblock ( return () ) does not work. Maybe if you do something to allocate some memory inside of the unblock? If this

[Haskell] Help needed interrupting accepting a network connection

2006-12-02 Thread Cat Dancer
I'd like to write a server accepting incoming network connections that can be gracefully shutdown. When the server is asked to shutdown, it should stop accepting new connections, finish processing any current connections, and then terminate. Clients can retry if they attempt to make a

Re: [Haskell] Help needed interrupting accepting a network connection

2006-12-02 Thread Cat Dancer
On 12/2/06, Chris Kuklewicz [EMAIL PROTECTED] wrote: Hi, I have taken a crack at this. The best thing would be not to use the asynchronous exceptions to signal the thread that calls accept. I'd certainly be most happy not to use asynchronous exceptions as the signalling mechanism, but how