context: Thread-indexed, nested contexts

[ data, library, mit ] [ Propose Tags ]

Thread-indexed storage around arbitrary context values. The interface supports nesting context values per thread, and at any point, the calling thread may ask for their current context.


[Skip to Readme]
Versions [faq] 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.12 && <5), containers (>=0.6.0.1 && <0.7) [details]
License MIT
Copyright 2020 (c) Jason Shipman
Author Jason Shipman
Maintainer Jason Shipman
Category Data
Home page https://github.com/jship/context#readme
Bug tracker https://github.com/jship/context/issues
Source repo head: git clone https://github.com/jship/context
Uploaded by jship at 2020-07-28T23:25:19Z
Distributions
Downloads 34 total (34 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2020-07-29 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for context-0.1.0.0

[back to package description]

context

Version badge

🚧 This README is under construction and could use some love. 🚧

context provides thread-indexed storage around arbitrary context values. The interface supports nesting context values per thread, and at any point, the calling thread may ask for their current context.

Synopsis

{-# LANGUAGE BlockArguments #-}

import qualified Context

data Thing = Thing
  { stuff :: Int
  }

main :: IO ()
main = do
  Context.withEmptyStore \store -> do
    Context.use store Thing { stuff = 1 } do
      Context.use store Thing { stuff = 2 } do
        thing2 <- Context.mine store
        -- ...
      number1 <- Context.mines store stuff

See the Haddocks for more info on the library.