Skip to content

Commit 45081c2

Browse files
committed
Merge branch 'master' of github.com:haskell-opengl/StateVar
2 parents 17ba6f9 + 83223e4 commit 45081c2

File tree

4 files changed

+109
-30
lines changed

4 files changed

+109
-30
lines changed

.travis.yml

Lines changed: 69 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,78 @@
1-
env:
2-
- CABALVER=1.16 GHCVER=7.0.4
3-
- CABALVER=1.16 GHCVER=7.2.2
4-
- CABALVER=1.16 GHCVER=7.4.2
5-
- CABALVER=1.16 GHCVER=7.6.3
6-
- CABALVER=1.18 GHCVER=7.8.3
7-
- CABALVER=1.20 GHCVER=7.8.4
8-
- CABALVER=1.22 GHCVER=7.10.1
9-
- CABALVER=head GHCVER=head
10-
1+
# It seems that we can't use the CABALVER and GHCVER environment variables in a
2+
# toplevel addons.apt.packages section, so we have to duplicate things below.
113
matrix:
4+
include:
5+
- env: CABALVER=1.16 GHCVER=7.0.4
6+
addons:
7+
apt:
8+
sources:
9+
- hvr-ghc
10+
packages:
11+
- cabal-install-1.16
12+
- ghc-7.0.4
13+
- env: CABALVER=1.16 GHCVER=7.2.2
14+
addons:
15+
apt:
16+
sources:
17+
- hvr-ghc
18+
packages:
19+
- cabal-install-1.16
20+
- ghc-7.2.2
21+
- env: CABALVER=1.16 GHCVER=7.4.2
22+
addons:
23+
apt:
24+
sources:
25+
- hvr-ghc
26+
packages:
27+
- cabal-install-1.16
28+
- ghc-7.4.2
29+
- env: CABALVER=1.16 GHCVER=7.6.3
30+
addons:
31+
apt:
32+
sources:
33+
- hvr-ghc
34+
packages:
35+
- cabal-install-1.16
36+
- ghc-7.6.3
37+
- env: CABALVER=1.20 GHCVER=7.8.4
38+
addons:
39+
apt:
40+
sources:
41+
- hvr-ghc
42+
packages:
43+
- cabal-install-1.20
44+
- ghc-7.8.4
45+
- env: CABALVER=1.22 GHCVER=7.10.3
46+
addons:
47+
apt:
48+
sources:
49+
- hvr-ghc
50+
packages:
51+
- cabal-install-1.22
52+
- ghc-7.10.3
53+
- env: CABALVER=1.24 GHCVER=8.0.1
54+
addons:
55+
apt:
56+
sources:
57+
- hvr-ghc
58+
packages:
59+
- cabal-install-1.24
60+
- ghc-8.0.1
61+
- env: CABALVER=head GHCVER=head
62+
addons:
63+
apt:
64+
sources:
65+
- hvr-ghc
66+
packages:
67+
- cabal-install-head
68+
- ghc-head
1269
allow_failures:
1370
- env: CABALVER=head GHCVER=head
1471

15-
before_install:
16-
- sudo add-apt-repository -y ppa:hvr/ghc
17-
- sudo apt-get update -qq
72+
sudo: false
1873

74+
# The packages from the PPA don't put this into the PATH automatically.
1975
install:
20-
- sudo apt-get install -qq cabal-install-$CABALVER ghc-$GHCVER
2176
- export PATH="/opt/cabal/$CABALVER/bin:/opt/ghc/$GHCVER/bin:$PATH"
2277

2378
before_script:

CHANGELOG.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
1-
1.1
2-
---
1+
1.1.0.3
2+
-------
3+
* Removed a couple of redundant typeclass constraints.
4+
5+
1.1.0.2
6+
-------
7+
* Relaxed upper version bound for `transformers`.
8+
9+
1.1.0.1
10+
-------
11+
* Documentation changes only.
12+
13+
1.1.0.0
14+
-------
315
* Melded the API of `foreign-var` 0.1 with the API of `StateVar` 1.0.1.1
416
* Introduced `HasUpdate`, which permits a wider array of uses of these combinators, including usecases that must update atomically.
517
* Switched to multi-parameter typeclasses. This permits `Ptr a` to be directly employed as an instance of `HasGetter`, `HasUpdate`, and `HasSetter`.
18+
19+
1.0.1.1
20+
-------
21+
* Infrastructure changes only.
22+
23+
1.0.1.0
24+
-------
25+
* Exposed `GettableStateVar`, `SettableStateVar` and `StateVar` constructors to make writing own instances possible.
26+
* Added `Functor`, `Applicative` and `Monad` instances for `GettableStateVar`.
27+
* Various infrastructure improvements.
28+
29+
1.0.0.0
30+
-------
31+
* Initial release.

StateVar.cabal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: StateVar
2-
version: 1.1.0.1
2+
version: 1.1.0.3
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
@@ -23,7 +23,7 @@ library
2323
build-depends:
2424
base >= 4 && < 5,
2525
stm >= 2.0 && < 2.5,
26-
transformers >= 0.2 && < 0.5
26+
transformers >= 0.2 && < 0.6
2727

2828
default-language: Haskell2010
2929
other-extensions:

src/Data/StateVar.hs

Lines changed: 9 additions & 11 deletions
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)