effectful-data-cache: Data cache effect for the `effectful` system

[ bsd3, cache, library ] [ Propose Tags ] [ Report a vulnerability ]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.1
Dependencies base (>=4.7 && <5), cache (>=0.1.3 && <0.2), clock (>=0.8 && <0.9), effectful-core (>=2.3 && <3), hashable (>=1.5 && <2), hs-opentelemetry-api (>=0.3 && <0.4), text (>=2.1 && <3) [details]
License BSD-3-Clause
Copyright 2026 drlkf
Author drlkf
Maintainer drlkf <drlkf@drlkf.net>
Uploaded by drlkf at 2026-09-29T00:25:06Z
Category cache
Home page https://github.com/haskell-github-trust/effectful-data-cache#readme
Bug tracker https://github.com/haskell-github-trust/effectful-data-cache/issues
Source repo head: git clone https://github.com/haskell-github-trust/effectful-data-cache
Distributions
Downloads 0 total (0 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-09-29 [all 1 reports]

Readme for effectful-data-cache-0.1.0.1

[back to package description]

effectful-data-cache

import Effectful
import Effectful.Cache
import Prelude hiding (lookup)

main :: IO ()
main = runEff . runCache Nothing $ do
  insert "key" (42 :: Int)
  v <- lookup @String @Int "key"
  liftIO $ print v

runCache creates a fresh store; runCacheWith wraps an existing Data.Cache.Cache so it can be shared with non-effectful code.

Tracing

traceCache wraps every operation in an OpenTelemetry span (cache.insert, cache.lookup, …), with cache.hit on lookups and cache.size on size/keys. Keys and values are never recorded.

import Effectful.Cache.OpenTelemetry (traceCache)

main = runEff . runCache Nothing . traceCache tracer $ do
  insert "key" (42 :: Int)

It is an interposer, so it layers over any interpreter and can be omitted without touching call sites.