RE: [Haskell-cafe] Top-level TVars
            
            
            
                15 Dec
                
                    2005
                
            
            
                15 Dec
                
                '05
                
            
            
            
        
    
                4:21 a.m.
            
        On 14 December 2005 20:39, Joel Reymont wrote:
On Wed, Dec 14, 2005 at 02:17:17PM -0000, 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 expression, so it must yield the same result, right?
Do these have to be within the same module for the CSE optimization to kick in?
Right now, yes. But there's no guarantee that GHC might not get cleverer in the future. We're skating on really thin ice here. I'm not particularly keen on re-opening the discussion about top-level IO, but we do need *something* better. Cheers, Simon
        7264
        
      
          Age (days ago)
        
      
        7264
        
    
          Last active (days ago)
        
        
        
        0 comments
    
    
        
        1 participants
    
    
    
    
    
    
    
    
    participants (1)
- 
                
Simon Marlow