heListToHistory (x:xs) =
    unsafePerformIO $ mdo d <- newTVarIO False
                          ww <- newIORef Nothing
                          p <- newTVarIO worker
                          n <- newTVarIO worker
                          ident <- allocateHistoryIdent
                          let worker = HistoryWorker { hw_dead = d,
                                                       hw_worker = ww,
                                                       hw_prev_lru = p,
                                                       hw_next_lru = n,
                                                       hw_is_root = False }
                          return $ History { hs_parent = heListToHistory xs,
                                             hs_entry = x,
                                             hs_worker = worker,
                                             hs_ident = ident }
heListToHistory (x:xs) =
    unsafePerformIO $ mdo d <- newTVarIO False
                          ww <- newIORef Nothing
                          p <- newTVarIO worker
                          n <- newTVarIO worker
                          ident <- allocateHistoryIdent
                          let worker = HistoryWorker { hw_dead = d,
                                                       hw_worker = ww,
                                                       hw_prev_lru = p,
                                                       hw_next_lru = n,
                                                       hw_is_root = False }
                          return $ History { hs_parent = heListToHistory xs,
                                             hs_entry = x,
                                             hs_worker = worker,
                                             hs_ident = ident }
heListToHistory (x:xs) =
    unsafePerformIO $ mdo d <- newTVarIO False
                          ww <- newIORef Nothing
                          p <- newTVarIO worker
                          n <- newTVarIO worker
                          ident <- allocateHistoryIdent
                          let worker = HistoryWorker { hw_dead = d,
                                                       hw_worker = ww,
                                                       hw_prev_lru = p,
                                                       hw_next_lru = n,
                                                       hw_is_root = False }
                          return $ History { hs_parent = heListToHistory xs,
                                             hs_entry = x,
                                             hs_worker = worker,
                                             hs_ident = ident }