MIT licensed and maintained by Jason Shipman
This version can be pinned in stack with:context-0.2.1.0@sha256:a538a9614c52ad74e0fcf17f2c3fa5767120ebea51616c06eba25a170c4f0cdd,1837

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.

Changes

Change log

0.2.1.0

  • Change NotFoundException from data to newtype

0.2.0.3

  • Relax upper bound on containers: 0.7 -> 0.8

0.2.0.2

  • Link test suite with -threaded RTS option

0.2.0.1

  • Backwards compatibility with GHC 8.4 (@pbrisbin)

0.2.0.0

  • Lift signatures from IO to MonadIO, MonadThrow and MonadMask
  • Type parameter order is now explicit via ScopedTypeVariables
  • Add withAdjusted convenience function
  • Re-export Context.View module from Context.Implicit

0.1.1.1

  • Correct Haddocks

0.1.1.0

  • Add Context.View module, which includes the View type + view, viewMay, and toView functions
  • Re-export Context.View from Context

0.1.0.0

  • Initial release