File tree Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ {-# LANGUAGE CPP #-}
2+
3+ #if __GLASGOW_HASKELL__ >= 701
4+ {-# LANGUAGE Trustworthy #-}
5+ #endif
6+
7+ -----------------------------------------------------------------------------
8+ -- |
9+ -- Module : Control.Monad.STM
10+ -- Copyright : (c) The University of Glasgow 2004
11+ -- License : BSD-style (see the file libraries/base/LICENSE)
12+ --
13+ -- Maintainer : libraries@haskell.org
14+ -- Stability : experimental
15+ -- Portability : non-portable (requires STM)
16+ --
17+ -- Class of monads based on @STM@.
18+ -----------------------------------------------------------------------------
19+
20+ module Control.Monad.STM.Class (
21+ MonadSTM (.. )
22+ ) where
23+
24+ import GHC.Conc (STM )
25+
26+
27+ -- | Monads in which 'STM' computations may be embedded.
28+ -- Any monad built by applying a sequence of monad transformers to the
29+ -- 'STM' monad will be an instance of this class.
30+ --
31+ -- Instances should satisfy the following laws, which state that 'liftSTM'
32+ -- is a transformer of monads:
33+ --
34+ -- * @'liftSTM' . 'return' = 'return'@
35+ --
36+ -- * @'liftSTM' (m >>= f) = 'liftSTM' m >>= ('liftSTM' . f)@
37+ class Monad m => MonadSTM m where
38+ -- | Lift a computation from the 'STM' monad.
39+ liftSTM :: STM a -> m a
40+
41+ -- | @since FIXME
42+ instance MonadSTM STM where
43+ liftSTM = id
Original file line number Diff line number Diff line change 11# Changelog for [ ` stm ` package] ( http://hackage.haskell.org/package/stm )
22
3+ ## Unreleased
4+
5+ * Added ` Control.Monad.STM.Class ` module
6+
7+ * Before release, update ` @since FIXME ` annotations
8+
39## 2.5.0.0 * Sep 2018*
410
511 * Removed ` alwaysSucceeds ` and ` always ` , GHC's invariant checking primitives. (GHC #14324 )
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ library
6060 Control.Concurrent.STM.TBQueue
6161 Control.Concurrent.STM.TSem
6262 Control.Monad.STM
63+ Control.Monad.STM.Class
6364 other-modules :
6465 Control.Sequential.STM
6566
You can’t perform that action at this time.
0 commit comments