{- Pull a WCE to the front of the LRU list -}
touchWorkerCacheEntry :: HistoryWorker -> IO ()
touchWorkerCacheEntry hw =
    if hw_is_root hw
    then return ()
    else do wc <- workerCache
            atomically $ do {- Remove from old place -}
                            prev <- readTVar $ hw_prev_lru hw
                            next <- readTVar $ hw_next_lru hw
                            writeTVar (hw_next_lru prev) next
                            writeTVar (hw_prev_lru next) prev

                            {- Insert in new place -}
                            let newPrev = wc_root wc
                            newNext <- readTVar (hw_next_lru newPrev)
                            writeTVar (hw_next_lru newPrev) hw
                            writeTVar (hw_prev_lru newNext) hw
                            writeTVar (hw_next_lru hw) newNext
                            writeTVar (hw_prev_lru hw) newPrev
touchWorkerCacheEntry :: HistoryWorker -> IO ()
touchWorkerCacheEntry hw =
    if hw_is_root hw
    then return ()
    else do wc <- workerCache
            atomically $ do {- Remove from old place -}
                            prev <- readTVar $ hw_prev_lru hw
                            next <- readTVar $ hw_next_lru hw
                            writeTVar (hw_next_lru prev) next
                            writeTVar (hw_prev_lru next) prev

                            {- Insert in new place -}
                            let newPrev = wc_root wc
                            newNext <- readTVar (hw_next_lru newPrev)
                            writeTVar (hw_next_lru newPrev) hw
                            writeTVar (hw_prev_lru newNext) hw
                            writeTVar (hw_next_lru hw) newNext
                            writeTVar (hw_prev_lru hw) newPrev
touchWorkerCacheEntry hw =
    if hw_is_root hw
    then return ()
    else do wc <- workerCache
            atomically $ do {- Remove from old place -}
                            prev <- readTVar $ hw_prev_lru hw
                            next <- readTVar $ hw_next_lru hw
                            writeTVar (hw_next_lru prev) next
                            writeTVar (hw_prev_lru next) prev

                            {- Insert in new place -}
                            let newPrev = wc_root wc
                            newNext <- readTVar (hw_next_lru newPrev)
                            writeTVar (hw_next_lru newPrev) hw
                            writeTVar (hw_prev_lru newNext) hw
                            writeTVar (hw_next_lru hw) newNext
                            writeTVar (hw_prev_lru hw) newPrev