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