RE: [Haskell-cafe] Top-level TVars

2005-12-15 Thread Simon Peyton-Jones
Yes, they do | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joel | Reymont | Sent: 14 December 2005 20:39 | To: Tomasz Zielonka | Cc: Simon Marlow; Haskell-Cafe Cafe | Subject: Re: [Haskell-cafe] Top-level TVars | | | On Wed, Dec 14, 2005 at 02:17

RE: [Haskell-cafe] Top-level TVars

2005-12-15 Thread Simon Marlow
On 14 December 2005 20:39, Joel Reymont wrote: On Wed, Dec 14, 2005 at 02:17:17PM -, Simon Marlow wrote: Suppose you create two top-level IORefs with the same type, like this: var1 = unsafePerformIO $ newIORef 0 var2 = unsafePerformIO $ newIORef 0 GHC's CSE optimisation will

RE: [Haskell-cafe] Top-level TVars

2005-12-14 Thread Simon Peyton-Jones
] [mailto:[EMAIL PROTECTED] On Behalf Of Joel | Reymont | Sent: 13 December 2005 18:08 | To: Haskell-Cafe Cafe | Subject: [Haskell-cafe] Top-level TVars | | Can this be done now or is this a GHC 6.5 feature? | | My combination of unsafePerformIO with atomically $ newTVar does not | seem to be working

RE: [Haskell-cafe] Top-level TVars

2005-12-14 Thread Simon Marlow
On 13 December 2005 18:34, Tomasz Zielonka wrote: On Tue, Dec 13, 2005 at 06:08:23PM +, Joel Reymont wrote: Can this be done now or is this a GHC 6.5 feature? My combination of unsafePerformIO with atomically $ newTVar does not seem to be working. Here is an example how you can

Re: [Haskell-cafe] Top-level TVars

2005-12-14 Thread Tomasz Zielonka
On Wed, Dec 14, 2005 at 09:51:16AM -, Simon Marlow wrote: Here is an example how you can initialize a top-level STM variable. http://www.uncurry.com/repos/TimeVar/TimeVar.hs It just forks a new thread inside unsafePerformIO, it runs atomically in it and passes the result through

RE: [Haskell-cafe] Top-level TVars

2005-12-14 Thread Simon Marlow
On 14 December 2005 09:57, Tomasz Zielonka wrote: On Wed, Dec 14, 2005 at 09:51:16AM -, Simon Marlow wrote: Here is an example how you can initialize a top-level STM variable. http://www.uncurry.com/repos/TimeVar/TimeVar.hs It just forks a new thread inside unsafePerformIO, it runs

Re: [Haskell-cafe] Top-level TVars

2005-12-14 Thread Tomasz Zielonka
On Wed, Dec 14, 2005 at 10:03:42AM -, Simon Marlow wrote: Well sure, but it's only a temporary problem. And you also have to tell them to use {-# NOINLINE #-} and -fno-cse :-) -fno-cse is also neccesary? Oops, I didn't know that. Can I simply place it in {-# OPTIONS -fno-cse #-} ? Best

Re: [Haskell-cafe] Top-level TVars

2005-12-14 Thread Joel Reymont
I'm a bit lost in the discussion. Why do I need -fno-cse and how do I seq at the top-level? On Dec 14, 2005, at 10:05 AM, Tomasz Zielonka wrote: On Wed, Dec 14, 2005 at 10:03:42AM -, Simon Marlow wrote: Well sure, but it's only a temporary problem. And you also have to tell them to

RE: [Haskell-cafe] Top-level TVars

2005-12-14 Thread Simon Marlow
On 14 December 2005 10:11, Joel Reymont wrote: I'm a bit lost in the discussion. Why do I need -fno-cse and how do I seq at the top-level? On Dec 14, 2005, at 10:05 AM, Tomasz Zielonka wrote: On Wed, Dec 14, 2005 at 10:03:42AM -, Simon Marlow wrote: Well sure, but it's only a

Re: [Haskell-cafe] Top-level TVars

2005-12-14 Thread Tomasz Zielonka
On Wed, Dec 14, 2005 at 02:17:17PM -, Simon Marlow wrote: Suppose you create two top-level IORefs with the same type, like this: var1 = unsafePerformIO $ newIORef 0 var2 = unsafePerformIO $ newIORef 0 GHC's CSE optimisation will common these up - after all, it's the same

Re: [Haskell-cafe] Top-level TVars

2005-12-14 Thread Joel Reymont
On Wed, Dec 14, 2005 at 02:17:17PM -, Simon Marlow wrote: Suppose you create two top-level IORefs with the same type, like this: var1 = unsafePerformIO $ newIORef 0 var2 = unsafePerformIO $ newIORef 0 GHC's CSE optimisation will common these up - after all, it's the same

[Haskell-cafe] Top-level TVars

2005-12-13 Thread Joel Reymont
Can this be done now or is this a GHC 6.5 feature? My combination of unsafePerformIO with atomically $ newTVar does not seem to be working. Thanks, Joel P.S. What is the ETA for 6.5? On Mon, Dec 05, 2005 at 10:50:13AM -, Simon Peyton-Jones wrote: It turns out to be

Re: [Haskell-cafe] Top-level TVars

2005-12-13 Thread Tomasz Zielonka
On Tue, Dec 13, 2005 at 06:08:23PM +, Joel Reymont wrote: Can this be done now or is this a GHC 6.5 feature? My combination of unsafePerformIO with atomically $ newTVar does not seem to be working. Here is an example how you can initialize a top-level STM variable.