-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3860cd1
commit 9c8a30c
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{-# LANGUAGE CPP #-} | ||
|
||
#if __GLASGOW_HASKELL__ >= 701 | ||
{-# LANGUAGE Trustworthy #-} | ||
#endif | ||
|
||
----------------------------------------------------------------------------- | ||
-- | | ||
-- Module : Control.Monad.STM | ||
-- Copyright : (c) The University of Glasgow 2004 | ||
-- License : BSD-style (see the file libraries/base/LICENSE) | ||
-- | ||
-- Maintainer : [email protected] | ||
-- Stability : experimental | ||
-- Portability : non-portable (requires STM) | ||
-- | ||
-- Class of monads based on @STM@. | ||
----------------------------------------------------------------------------- | ||
|
||
module Control.Monad.STM.Class ( | ||
MonadSTM(..) | ||
) where | ||
|
||
import GHC.Conc (STM) | ||
|
||
|
||
-- | Monads in which 'STM' computations may be embedded. | ||
-- Any monad built by applying a sequence of monad transformers to the | ||
-- 'STM' monad will be an instance of this class. | ||
-- | ||
-- Instances should satisfy the following laws, which state that 'liftSTM' | ||
-- is a transformer of monads: | ||
-- | ||
-- * @'liftSTM' . 'return' = 'return'@ | ||
-- | ||
-- * @'liftSTM' (m >>= f) = 'liftSTM' m >>= ('liftSTM' . f)@ | ||
class Monad m => MonadSTM m where | ||
-- | Lift a computation from the 'STM' monad. | ||
liftSTM :: STM a -> m a | ||
|
||
-- | @since FIXME | ||
instance MonadSTM STM where | ||
liftSTM = id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters