diff --git a/CHANGELOG.md b/CHANGELOG.md index e0e537f..0750bce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ -1.1 ---- +1.1.0.1 +------- +* Documentation changes only. + +1.1.0.0 +------- * Melded the API of `foreign-var` 0.1 with the API of `StateVar` 1.0.1.1 * Introduced `HasUpdate`, which permits a wider array of uses of these combinators, including usecases that must update atomically. * Switched to multi-parameter typeclasses. This permits `Ptr a` to be directly employed as an instance of `HasGetter`, `HasUpdate`, and `HasSetter`. + +1.0.1.1 +------- +* Infrastructure changes only. + +1.0.1.0 +------- +* Exposed `GettableStateVar`, `SettableStateVar` and `StateVar` constructors to make writing own instances possible. +* Added `Functor`, `Applicative` and `Monad` instances for `GettableStateVar`. +* Various infrastructure improvements. + +1.0.0.0 +------- +* Initial release. diff --git a/StateVar.cabal b/StateVar.cabal index 1db49a9..629c176 100644 --- a/StateVar.cabal +++ b/StateVar.cabal @@ -1,12 +1,12 @@ name: StateVar -version: 1.1.0.0 +version: 1.1.0.1 synopsis: State variables description: This package contains state variables, which are references in the IO monad, like IORefs or parts of the OpenGL state. homepage: https://github.com/haskell-opengl/StateVar bug-reports: https://github.com/haskell-opengl/StateVar/issues -copyright: Copyright (C) 2014-2015 Edward A. Kmett, 2009-2014 Sven Panne +copyright: Copyright (C) 2014-2015 Edward A. Kmett, 2009-2015 Sven Panne license: BSD3 license-file: LICENSE author: Sven Panne and Edward Kmett diff --git a/src/Data/StateVar.hs b/src/Data/StateVar.hs index cddc8a6..f868319 100644 --- a/src/Data/StateVar.hs +++ b/src/Data/StateVar.hs @@ -90,17 +90,13 @@ import Foreign.Storable -- | A concrete implementation of a readable and writable state variable, -- carrying one IO action to read the value and another IO action to write the --- new value. +-- new value. This data type represents a piece of mutable, imperative state +-- with possible side-effects. These tend to encapsulate all sorts tricky +-- behavior in external libraries, and may well throw exceptions. Inhabitants +-- __should__ satsify the following properties: -- --- This data type represents a piece of mutable, imperative state --- with possible side-effects. These tend to encapsulate all sorts --- tricky behavior in external libraries, and may well throw --- exceptions. --- --- Inhabitants __should__ satsify the following properties. --- --- In the absence of concurrent mutation from other threads or a --- thrown exception: +-- * In the absence of concurrent mutation from other threads or a thrown +-- exception: -- -- @ -- do x <- 'get' v; v '$=' y; v '$=' x @@ -108,7 +104,7 @@ import Foreign.Storable -- -- should restore the previous state. -- --- Ideally, in the absence of thrown exceptions: +-- * Ideally, in the absence of thrown exceptions: -- -- @ -- v '$=' a >> 'get' v @@ -196,6 +192,7 @@ instance HasSetter (TVar a) a where infixr 2 $~, $~! +-- | This is the class of all updatable state variables. class HasSetter t a => HasUpdate t a b | t -> a b where -- | Transform the contents of a state variable with a given funtion. ($~) :: MonadIO m => t -> (a -> b) -> m () @@ -250,6 +247,7 @@ instance HasUpdate (TVar a) a a where -- * HasGetter -------------------------------------------------------------------- +-- | This is the class of all readable state variables. class HasGetter t a | t -> a where get :: MonadIO m => t -> m a