MIT licensed and maintained by Jason Shipman
This version can be pinned in stack with:context-0.2.0.1@sha256:b5a1390a5ad11b7edd0449c9ef96823f082bff4988bd09583e37a4e93e9aad10,1891

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.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