Re: [Haskell-cafe] Concurrent Haskell Actions with Timeout

2009-05-30 Thread Cetin Sert
-__-" hehe why did I not let Hayoo or Hoogle help me there *sigh* Thanks!! 2009/5/31 Sterling Clover > The proper way is just to wrap System.Timeout, which does some rather > clever things with regards to exception semantics. The code for it is a joy > to read, by the way. > > --S. > > > On May

Re: [Haskell-cafe] Concurrent Haskell Actions with Timeout

2009-05-30 Thread Sterling Clover
The proper way is just to wrap System.Timeout, which does some rather clever things with regards to exception semantics. The code for it is a joy to read, by the way. --S. On May 30, 2009, at 5:36 PM, Sebastian Sylvan wrote: On Sat, May 30, 2009 at 10:32 PM, Cetin Sert wrote: Thank y

Re: [Haskell-cafe] Concurrent Haskell Actions with Timeout

2009-05-30 Thread Sebastian Sylvan
On Sat, May 30, 2009 at 10:32 PM, Cetin Sert wrote: > Thank you for your reply, I'd come up with the following: > > timed :: Int → IO a → b → IO (Either b a) > timed max act def = do > > r ← new > > t ← forkIO $ do > a ← act > r ≔ Right a > > s ← forkIO $ do > wait max > e ←

Re: [Haskell-cafe] Concurrent Haskell Actions with Timeout

2009-05-30 Thread Cetin Sert
Thank you for your reply, I'd come up with the following: timed :: Int → IO a → b → IO (Either b a) timed max act def = do r ← new t ← forkIO $ do a ← act r ≔ Right a s ← forkIO $ do wait max e ← em r case e of True → do kill t r ≔ Left def

Re: [Haskell-cafe] Concurrent Haskell Actions with Timeout

2009-05-30 Thread Sebastian Sylvan
2009/5/30 Cetin Sert > Hi how could one implement a function in concurrent haskell that either > returns 'a' successfully or due timeout 'b'? > > timed :: Int → IO a → b → IO (Either a b) > timed max act def = do > Something like (warning, untested code - no compiler atm). timed timeout act fa

[Haskell-cafe] Concurrent Haskell Actions with Timeout

2009-05-30 Thread Cetin Sert
Hi how could one implement a function in concurrent haskell that either returns 'a' successfully or due timeout 'b'? timed :: Int → IO a → b → IO (Either a b) timed max act def = do Best Regards, Cetin Sert ___ Haskell-Cafe mailing list Haskell-Cafe@has