whenWVarIsUpdatingAndCacheStaled :: (Eq v, Q.Arbitrary v) =>
    (IO (v, v, WV.WVar v, WV.WCached v) -> HS.Spec) -> HS.Spec
whenWVarIsUpdatingAndCacheStaled f =
    HS.describe "when WVar is updating and cache staled" $ f prepare
  where
    prepare = do
        val <- Q.generate Q.arbitrary
        wv  <- WV.newWVar val
        wc  <- WV.cacheWVar wv
        M.void $ WV.takeWVar wv
        return (val, val, wv, wc)
whenWVarIsUpdatingAndCacheStaled :: (Eq v, Q.Arbitrary v) =>
    (IO (v, v, WV.WVar v, WV.WCached v) -> HS.Spec) -> HS.Spec
whenWVarIsUpdatingAndCacheStaled f =
    HS.describe "when WVar is updating and cache staled" $ f prepare
  where
    prepare = do
        val <- Q.generate Q.arbitrary
        wv  <- WV.newWVar val
        wc  <- WV.cacheWVar wv
        M.void $ WV.takeWVar wv
        return (val, val, wv, wc)
whenWVarIsUpdatingAndCacheStaled f =
    HS.describe "when WVar is updating and cache staled" $ f prepare
  where
    prepare = do
        val <- Q.generate Q.arbitrary
        wv  <- WV.newWVar val
        wc  <- WV.cacheWVar wv
        M.void $ WV.takeWVar wv
        return (val, val, wv, wc)