File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -168,12 +168,15 @@ normalizeStep q binds = do
168168  res <-  Monad. liftIO $  MS. tryPopR q
169169  case  res of 
170170      Just  id' ->  do 
171-         (bound, _) <-  MVar. readMVar binds
172-         unless (id' `elemVarSet`  bound) $  do 
173-           --  immediately mark this work as being done
174-           MVar. modifyMVar_ binds (pure  .  first (`extendVarSet`  id'))
175-           pair <-  normalize' id' q
176-           MVar. modifyMVar_ binds (pure  .  second (pair: ))
171+         (bound, pairs) <-  MVar. takeMVar binds
172+         if  not  (id' `elemVarSet`  bound)
173+           then  do 
174+             --  mark that we are attempting to normalize id'
175+             MVar. putMVar binds (bound `extendVarSet`  id', pairs)
176+             pair <-  normalize' id' q
177+             MVar. modifyMVar_ binds (pure  .  second (pair: ))
178+           else 
179+             MVar. putMVar binds (bound, pairs)
177180        normalizeStep q binds
178181      Nothing   ->  pure  () 
179182
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments