withLatestCache ::
    (IO (v, v, WV.WVar v, WV.WCached v) -> r) -> IO (v, WV.WVar v) -> r
withLatestCache f prepare = f prepare'
  where
    prepare' = do
        (val, wv) <- prepare
        wc        <- WV.cacheWVar wv
        return (val, val, wv, wc)
withLatestCache ::
    (IO (v, v, WV.WVar v, WV.WCached v) -> r) -> IO (v, WV.WVar v) -> r
withLatestCache f prepare = f prepare'
  where
    prepare' = do
        (val, wv) <- prepare
        wc        <- WV.cacheWVar wv
        return (val, val, wv, wc)
withLatestCache f prepare = f prepare'
  where
    prepare' = do
        (val, wv) <- prepare
        wc        <- WV.cacheWVar wv
        return (val, val, wv, wc)