context: Thread-indexed, nested contexts

[ data, library, mit ] [ Propose Tags ] [ Report a vulnerability ]

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

Package maintainers

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, 0.2.0.1, 0.2.0.2, 0.2.0.3, 0.2.1.0
Change log CHANGELOG.md
Dependencies base (>=4.11.1.0 && <5), containers (>=0.5.11.0 && <0.8), 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://sr.ht/~jship/context/
Source repo head: git clone https://git.sr.ht/~jship/context/
Uploaded by jship at 2024-03-16T17:44:44Z
Distributions LTSHaskell:0.2.1.0, NixOS:0.2.1.0, Stackage:0.2.1.0
Reverse Dependencies 4 direct, 11 indirect [details]
Downloads 1838 total (38 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2024-03-16 [all 1 reports]

Readme for context-0.2.1.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.