Skip to content

Commit

Permalink
Improved documentation a tiny bit. Bumped version to 1.1.0.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
svenpanne committed Aug 5, 2015
1 parent 68c8fc1 commit afa1943
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
22 changes: 20 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions StateVar.cabal
Original file line number Diff line number Diff line change
@@ -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
Expand Down
20 changes: 9 additions & 11 deletions src/Data/StateVar.hs
Original file line number Diff line number Diff line change
Expand Up @@ -90,25 +90,21 @@ 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
-- @
--
-- should restore the previous state.
--
-- Ideally, in the absence of thrown exceptions:
-- * Ideally, in the absence of thrown exceptions:
--
-- @
-- v '$=' a >> 'get' v
Expand Down Expand Up @@ -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 ()
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit afa1943

Please # to comment.