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]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1.0, 0.1.1.1, 0.2.0.0
Change log CHANGELOG.md
Dependencies base (>=4.12 && <5), containers (>=0.6.0.1 && <0.7), exceptions (>=0.10.0 && <0.11) [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 2022-05-01T01:02:53Z
Distributions NixOS:0.2.0.0, Stackage:0.2.0.0
Downloads 582 total (49 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-05-01 [all 1 reports]

Readme for context-0.2.0.0

[back to package description]

context

Version badge

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.