Skip to content

Commit afa1943

Browse files
committed
Improved documentation a tiny bit. Bumped version to 1.1.0.1.
1 parent 68c8fc1 commit afa1943

File tree

3 files changed

+31
-15
lines changed

3 files changed

+31
-15
lines changed

CHANGELOG.md

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
1-
1.1
2-
---
1+
1.1.0.1
2+
-------
3+
* Documentation changes only.
4+
5+
1.1.0.0
6+
-------
37
* Melded the API of `foreign-var` 0.1 with the API of `StateVar` 1.0.1.1
48
* Introduced `HasUpdate`, which permits a wider array of uses of these combinators, including usecases that must update atomically.
59
* Switched to multi-parameter typeclasses. This permits `Ptr a` to be directly employed as an instance of `HasGetter`, `HasUpdate`, and `HasSetter`.
10+
11+
1.0.1.1
12+
-------
13+
* Infrastructure changes only.
14+
15+
1.0.1.0
16+
-------
17+
* Exposed `GettableStateVar`, `SettableStateVar` and `StateVar` constructors to make writing own instances possible.
18+
* Added `Functor`, `Applicative` and `Monad` instances for `GettableStateVar`.
19+
* Various infrastructure improvements.
20+
21+
1.0.0.0
22+
-------
23+
* Initial release.

StateVar.cabal

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: StateVar
2-
version: 1.1.0.0
2+
version: 1.1.0.1
33
synopsis: State variables
44
description:
55
This package contains state variables, which are references in the IO monad,
66
like IORefs or parts of the OpenGL state.
77
homepage: https://github.com/haskell-opengl/StateVar
88
bug-reports: https://github.com/haskell-opengl/StateVar/issues
9-
copyright: Copyright (C) 2014-2015 Edward A. Kmett, 2009-2014 Sven Panne
9+
copyright: Copyright (C) 2014-2015 Edward A. Kmett, 2009-2015 Sven Panne
1010
license: BSD3
1111
license-file: LICENSE
1212
author: Sven Panne and Edward Kmett

src/Data/StateVar.hs

+9-11
Original file line numberDiff line numberDiff line change
@@ -90,25 +90,21 @@ import Foreign.Storable
9090

9191
-- | A concrete implementation of a readable and writable state variable,
9292
-- carrying one IO action to read the value and another IO action to write the
93-
-- new value.
93+
-- new value. This data type represents a piece of mutable, imperative state
94+
-- with possible side-effects. These tend to encapsulate all sorts tricky
95+
-- behavior in external libraries, and may well throw exceptions. Inhabitants
96+
-- __should__ satsify the following properties:
9497
--
95-
-- This data type represents a piece of mutable, imperative state
96-
-- with possible side-effects. These tend to encapsulate all sorts
97-
-- tricky behavior in external libraries, and may well throw
98-
-- exceptions.
99-
--
100-
-- Inhabitants __should__ satsify the following properties.
101-
--
102-
-- In the absence of concurrent mutation from other threads or a
103-
-- thrown exception:
98+
-- * In the absence of concurrent mutation from other threads or a thrown
99+
-- exception:
104100
--
105101
-- @
106102
-- do x <- 'get' v; v '$=' y; v '$=' x
107103
-- @
108104
--
109105
-- should restore the previous state.
110106
--
111-
-- Ideally, in the absence of thrown exceptions:
107+
-- * Ideally, in the absence of thrown exceptions:
112108
--
113109
-- @
114110
-- v '$=' a >> 'get' v
@@ -196,6 +192,7 @@ instance HasSetter (TVar a) a where
196192

197193
infixr 2 $~, $~!
198194

195+
-- | This is the class of all updatable state variables.
199196
class HasSetter t a => HasUpdate t a b | t -> a b where
200197
-- | Transform the contents of a state variable with a given funtion.
201198
($~) :: MonadIO m => t -> (a -> b) -> m ()
@@ -250,6 +247,7 @@ instance HasUpdate (TVar a) a a where
250247
-- * HasGetter
251248
--------------------------------------------------------------------
252249

250+
-- | This is the class of all readable state variables.
253251
class HasGetter t a | t -> a where
254252
get :: MonadIO m => t -> m a
255253

0 commit comments

Comments
 (0)