diff --git a/.travis.yml b/.travis.yml index d80b2cb..4c4c159 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,78 @@ -env: - - CABALVER=1.16 GHCVER=7.0.4 - - CABALVER=1.16 GHCVER=7.2.2 - - CABALVER=1.16 GHCVER=7.4.2 - - CABALVER=1.16 GHCVER=7.6.3 - - CABALVER=1.18 GHCVER=7.8.3 - - CABALVER=1.20 GHCVER=7.8.4 - - CABALVER=1.22 GHCVER=7.10.1 - - CABALVER=head GHCVER=head - +# It seems that we can't use the CABALVER and GHCVER environment variables in a +# toplevel addons.apt.packages section, so we have to duplicate things below. matrix: + include: + - env: CABALVER=1.16 GHCVER=7.0.4 + addons: + apt: + sources: + - hvr-ghc + packages: + - cabal-install-1.16 + - ghc-7.0.4 + - env: CABALVER=1.16 GHCVER=7.2.2 + addons: + apt: + sources: + - hvr-ghc + packages: + - cabal-install-1.16 + - ghc-7.2.2 + - env: CABALVER=1.16 GHCVER=7.4.2 + addons: + apt: + sources: + - hvr-ghc + packages: + - cabal-install-1.16 + - ghc-7.4.2 + - env: CABALVER=1.16 GHCVER=7.6.3 + addons: + apt: + sources: + - hvr-ghc + packages: + - cabal-install-1.16 + - ghc-7.6.3 + - env: CABALVER=1.20 GHCVER=7.8.4 + addons: + apt: + sources: + - hvr-ghc + packages: + - cabal-install-1.20 + - ghc-7.8.4 + - env: CABALVER=1.22 GHCVER=7.10.3 + addons: + apt: + sources: + - hvr-ghc + packages: + - cabal-install-1.22 + - ghc-7.10.3 + - env: CABALVER=1.24 GHCVER=8.0.1 + addons: + apt: + sources: + - hvr-ghc + packages: + - cabal-install-1.24 + - ghc-8.0.1 + - env: CABALVER=head GHCVER=head + addons: + apt: + sources: + - hvr-ghc + packages: + - cabal-install-head + - ghc-head allow_failures: - env: CABALVER=head GHCVER=head -before_install: - - sudo add-apt-repository -y ppa:hvr/ghc - - sudo apt-get update -qq +sudo: false +# The packages from the PPA don't put this into the PATH automatically. install: - - sudo apt-get install -qq cabal-install-$CABALVER ghc-$GHCVER - export PATH="/opt/cabal/$CABALVER/bin:/opt/ghc/$GHCVER/bin:$PATH" before_script: diff --git a/CHANGELOG.md b/CHANGELOG.md index e0e537f..5e41809 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ -1.1 ---- +1.1.0.3 +------- +* Removed a couple of redundant typeclass constraints. + +1.1.0.2 +------- +* Relaxed upper version bound for `transformers`. + +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 713aa10..f845f46 100644 --- a/StateVar.cabal +++ b/StateVar.cabal @@ -1,12 +1,12 @@ name: StateVar -version: 1.1.0.1 +version: 1.1.0.3 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 @@ -23,7 +23,7 @@ library build-depends: base >= 4 && < 5, stm >= 2.0 && < 2.5, - transformers >= 0.2 && < 0.5 + transformers >= 0.2 && < 0.6 default-language: Haskell2010 other-extensions: diff --git a/src/Data/StateVar.hs b/src/Data/StateVar.hs index 4c3d6d4..3adcd29 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