stm 2.1.2.0 → 2.1.2.1
raw patch · 7 files changed
+29/−5 lines, 7 filesdep ~arraydep ~base
Dependency ranges changed: array, base
Files
- Control/Concurrent/STM/TArray.hs +4/−1
- Control/Concurrent/STM/TChan.hs +5/−1
- Control/Concurrent/STM/TMVar.hs +5/−1
- Control/Concurrent/STM/TVar.hs +4/−0
- Control/Monad/STM.hs +4/−0
- Control/Sequential/STM.hs +6/−1
- stm.cabal +1/−1
Control/Concurrent/STM/TArray.hs view
@@ -1,4 +1,6 @@ {-# OPTIONS -fglasgow-exts #-}+{-# LANGUAGE DeriveDataTypeable #-}+ ----------------------------------------------------------------------------- -- | -- Module : Control.Concurrent.STM.TArray@@ -22,6 +24,7 @@ import Data.Array.Base (listArray, arrEleBottom, unsafeAt, MArray(..), IArray(numElements)) import Data.Ix (rangeSize)+import Data.Typeable (Typeable) import Control.Concurrent.STM.TVar (TVar, newTVar, readTVar, writeTVar) #ifdef __GLASGOW_HASKELL__ import GHC.Conc (STM)@@ -36,7 +39,7 @@ -- but it may be replaced by a more efficient implementation in the future -- (the interface will remain the same, however). ---newtype TArray i e = TArray (Array i (TVar e))+newtype TArray i e = TArray (Array i (TVar e)) deriving (Eq, Typeable) instance MArray TArray e STM where getBounds (TArray a) = return (bounds a)
Control/Concurrent/STM/TChan.hs view
@@ -1,4 +1,6 @@ {-# OPTIONS_GHC -fno-warn-name-shadowing #-}+{-# LANGUAGE DeriveDataTypeable #-}+ ----------------------------------------------------------------------------- -- | -- Module : Control.Concurrent.STM.TChan@@ -31,8 +33,10 @@ #ifdef __GLASGOW_HASKELL__ import GHC.Conc +import Data.Typeable (Typeable)+ -- | 'TChan' is an abstract type representing an unbounded FIFO channel.-data TChan a = TChan (TVar (TVarList a)) (TVar (TVarList a))+data TChan a = TChan (TVar (TVarList a)) (TVar (TVarList a)) deriving Typeable type TVarList a = TVar (TList a) data TList a = TNil | TCons a (TVarList a)
Control/Concurrent/STM/TMVar.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE DeriveDataTypeable #-}+ ----------------------------------------------------------------------------- -- | -- Module : Control.Concurrent.STM.TMVar@@ -34,7 +36,9 @@ #ifdef __GLASGOW_HASKELL__ import GHC.Conc -newtype TMVar a = TMVar (TVar (Maybe a))+import Data.Typeable (Typeable)++newtype TMVar a = TMVar (TVar (Maybe a)) deriving (Eq, Typeable) {- ^ A 'TMVar' is a synchronising variable, used for communication between concurrent threads. It can be thought of
Control/Concurrent/STM/TVar.hs view
@@ -30,3 +30,7 @@ #else import Control.Sequential.STM #endif++#if ! MIN_VERSION_base(4,2,0)+readTVarIO = atomically . readTVar+#endif
Control/Monad/STM.hs view
@@ -36,15 +36,19 @@ #ifdef __GLASGOW_HASKELL__ import GHC.Conc+#if ! MIN_VERSION_base(4,3,0) import Control.Monad ( MonadPlus(..) )+#endif #else import Control.Sequential.STM #endif #ifdef __GLASGOW_HASKELL__+#if ! MIN_VERSION_base(4,3,0) instance MonadPlus STM where mzero = retry mplus = orElse+#endif check :: Bool -> STM a check b = if b then return undefined else retry
Control/Sequential/STM.hs view
@@ -9,6 +9,7 @@ ) where import Prelude hiding (catch)+import Control.Applicative (Applicative(pure, (<*>))) import Control.Exception import Data.IORef @@ -21,8 +22,12 @@ instance Functor STM where fmap f (STM m) = STM (fmap f . m) +instance Applicative STM where+ pure = STM . const . pure+ STM mf <*> STM mx = STM $ \ r -> mf r <*> mx r+ instance Monad STM where- return x = STM (const (return x))+ return = pure STM m >>= k = STM $ \ r -> do x <- m r unSTM (k x) r
stm.cabal view
@@ -1,5 +1,5 @@ name: stm-version: 2.1.2.0+version: 2.1.2.1 license: BSD3 license-file: LICENSE maintainer: libraries@haskell.org