initialHistory :: Logfile -> Worker -> IO History
initialHistory lf w =
    do p <- newTVarIO undefined
       n <- newTVarIO undefined
       isDead <- newTVarIO False
       worker <- newIORef $ Just w
       let wrk = HistoryWorker { hw_dead = isDead, hw_worker = worker,
                                 hw_prev_lru = p, hw_next_lru = n, hw_is_root = True }
       atomically $ writeTVar p wrk
       atomically $ writeTVar n wrk
       nr <- newTVarIO 0
       idents <- newIORef [1..]
       let wc = WorkerCache { wc_logfile = lf, wc_root = wrk, wc_nr_workers = nr, wc_idents = idents}
       writeIORef globalWorkerCache wc
       return $ HistoryRoot wrk
initialHistory :: Logfile -> Worker -> IO History
initialHistory lf w =
    do p <- newTVarIO undefined
       n <- newTVarIO undefined
       isDead <- newTVarIO False
       worker <- newIORef $ Just w
       let wrk = HistoryWorker { hw_dead = isDead, hw_worker = worker,
                                 hw_prev_lru = p, hw_next_lru = n, hw_is_root = True }
       atomically $ writeTVar p wrk
       atomically $ writeTVar n wrk
       nr <- newTVarIO 0
       idents <- newIORef [1..]
       let wc = WorkerCache { wc_logfile = lf, wc_root = wrk, wc_nr_workers = nr, wc_idents = idents}
       writeIORef globalWorkerCache wc
       return $ HistoryRoot wrk
initialHistory lf w =
    do p <- newTVarIO undefined
       n <- newTVarIO undefined
       isDead <- newTVarIO False
       worker <- newIORef $ Just w
       let wrk = HistoryWorker { hw_dead = isDead, hw_worker = worker,
                                 hw_prev_lru = p, hw_next_lru = n, hw_is_root = True }
       atomically $ writeTVar p wrk
       atomically $ writeTVar n wrk
       nr <- newTVarIO 0
       idents <- newIORef [1..]
       let wc = WorkerCache { wc_logfile = lf, wc_root = wrk, wc_nr_workers = nr, wc_idents = idents}
       writeIORef globalWorkerCache wc
       return $ HistoryRoot wrk