addWorkerToLRU :: HistoryWorker -> Worker -> IO ()
addWorkerToLRU hw worker =
    do wc <- workerCache
       writeIORef (hw_worker hw) $ Just worker
       atomically $ let newPrev = wc_root wc in
                    do writeTVar (hw_dead hw) False
                       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
                       modifyTVar (wc_nr_workers wc) ((+) 1)
addWorkerToLRU :: HistoryWorker -> Worker -> IO ()
addWorkerToLRU hw worker =
    do wc <- workerCache
       writeIORef (hw_worker hw) $ Just worker
       atomically $ let newPrev = wc_root wc in
                    do writeTVar (hw_dead hw) False
                       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
                       modifyTVar (wc_nr_workers wc) ((+) 1)
addWorkerToLRU hw worker =
    do wc <- workerCache
       writeIORef (hw_worker hw) $ Just worker
       atomically $ let newPrev = wc_root wc in
                    do writeTVar (hw_dead hw) False
                       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
                       modifyTVar (wc_nr_workers wc) ((+) 1)