Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
data Param m k v = Param {
cacheSize :: Int
, table :: H.HashTableSTM k (Ref v)
, toIO :: forall a. m a -> IO a
, lock :: TVar Int
}
newtype CacheSTM m k v a = CacheSTM { runCacheSTM :: ReaderT (Param m k v) STM a }
deriving (Monad, MonadReader (Param m k v), Functor)
evalCacheSTM :: Param m k v -> CacheSTM m k v a -> IO a
evalCacheSTM p m =
atomically $ runReaderT (runCacheSTM m) p
sizedParam :: Int -> (forall a. m a -> IO a) -> IO (Param m k v)
sizedParam s f = do
ht <- H.newSized s
mv <- atomically $ newTVar 0
return $ Param s ht f mv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.