Repository : ssh://darcs.haskell.org//srv/darcs/packages/stm

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/acb99cfbf64d75d8faa680c6b4df48a7f87f6633

>---------------------------------------------------------------

commit acb99cfbf64d75d8faa680c6b4df48a7f87f6633
Author: Simon Marlow <[email protected]>
Date:   Wed Aug 8 10:45:59 2012 +0100

    Add Applicative/Alternative instances of STM for GHC <7.0 (#4076)

>---------------------------------------------------------------

 Control/Monad/STM.hs |   12 ++++++++++++
 stm.cabal            |    6 +++++-
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/Control/Monad/STM.hs b/Control/Monad/STM.hs
index 0bcd791..30bbae7 100644
--- a/Control/Monad/STM.hs
+++ b/Control/Monad/STM.hs
@@ -55,11 +55,23 @@ import Control.Monad.Fix
 import Control.Sequential.STM
 #endif
 
+import Control.Applicative
+import Control.Monad (ap)
+
+
 #ifdef __GLASGOW_HASKELL__
 #if ! (MIN_VERSION_base(4,3,0))
 instance MonadPlus STM where
   mzero = retry
   mplus = orElse
+
+instance Applicative STM where
+  pure = return
+  (<*>) = ap
+
+instance Alternative STM where
+  empty = retry
+  (<|>) = orElse
 #endif
 
 check :: Bool -> STM ()
diff --git a/stm.cabal b/stm.cabal
index 9871359..2657e23 100644
--- a/stm.cabal
+++ b/stm.cabal
@@ -1,5 +1,5 @@
 name:          stm
-version:        2.4
+version:        2.4.1
 license:       BSD3
 license-file:  LICENSE
 maintainer:    [email protected]
@@ -8,6 +8,10 @@ category:       Concurrency
 description:
  A modular composable concurrency abstraction.
  .
+ Changes in version 2.4.1
+ .
+ * Added Applicative/Alternative instances of STM for GHC <7.0
+ .
  Changes in version 2.4
  .
  * Added "Control.Concurrent.STM.TQueue" (a faster @TChan@)



_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to