Re: [Haskell-cafe] Caching the Result of a Transaction?

2008-04-27 Thread Jake Mcarthur
On Apr 27, 2008, at 10:05 AM, Jake Mcarthur wrote: On Apr 27, 2008, at 9:36 AM, Conal Elliott wrote: I think we *do* want unsafeNewEmptyTMVar inlined. Here's a convenient caching wrapper: cached :: STM a - TIVal a cached m = TIVal m (unsafePerformIO newEmptyTMVarIO) Yes, this is

Re: [Haskell-cafe] Caching the Result of a Transaction?

2008-04-26 Thread Conal Elliott
Here's another angle on part of Jake's question: Can we implement a type 'TIVal a' (preferably without unsafePerformIO) with the following interface: newIVal :: STM (TIVal a, a - STM ()) -- or IO (...) force :: TIVal a - STM a instance Functor IVal instance Applicative

Re: [Haskell-cafe] Caching the Result of a Transaction?

2008-04-26 Thread Matthew Brecknell
Conal Elliott said: Can we implement a type 'TIVal a' (preferably without unsafePerformIO) with the following interface: newIVal :: STM (TIVal a, a - STM ()) -- or IO (...) force :: TIVal a - STM a instance Functor IVal instance Applicative IVal instance Monad

Re: [Haskell-cafe] Caching the Result of a Transaction?

2008-04-26 Thread Jake Mcarthur
On Apr 26, 2008, at 7:18 PM, Conal Elliott wrote: Here's another angle on part of Jake's question: Can we implement a type 'TIVal a' (preferably without unsafePerformIO) with the following interface: newIVal :: STM (TIVal a, a - STM ()) -- or IO (...) force :: TIVal a - STM a