sullyj3 / cache-effectful

Bindings to the `cache` library for the Effectful ecosystem

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

effectful-cache CI-badge

A Cache effect for the effectful ecosystem.

How to use

This library exposes the following elements:

  • Cache — The type-level effect that you can declare in your type signatures.
populateIntCache :: (Cache Int Int :> es) => Eff es ()
  • insert, lookup, keys, delete, filterWithKey – Operations on Cache. They should always be used with Type Applications when using literals:
insertAndLookup :: (Cache Int Int :> es) => Eff es (Maybe Int)
insertAndLookup = do
  insert @Int @Int 3 12
  lookup @Int 3

listKeys :: (Cache Int Int :> es) => Eff es [Int]
listKeys = do
  populateIntCache
  keys @Int @Int
  • An IO Runner
runCacheIO (cache :: Data.Cache Int Int)

See the tests to see an example use.

About

Bindings to the `cache` library for the Effectful ecosystem

License:MIT License


Languages

Language:Haskell 92.7%Language:Makefile 7.3%