Update base for latest Safe Haskell.
[packages/base.git] / Control / Monad / ST.hs
1 {-# LANGUAGE Unsafe #-}
2
3 -----------------------------------------------------------------------------
4 -- |
5 -- Module : Control.Monad.ST
6 -- Copyright : (c) The University of Glasgow 2001
7 -- License : BSD-style (see the file libraries/base/LICENSE)
8 --
9 -- Maintainer : libraries@haskell.org
10 -- Stability : experimental
11 -- Portability : non-portable (requires universal quantification for runST)
12 --
13 -- This library provides support for /strict/ state threads, as
14 -- described in the PLDI \'94 paper by John Launchbury and Simon Peyton
15 -- Jones /Lazy Functional State Threads/.
16 --
17 -----------------------------------------------------------------------------
18
19 module Control.Monad.ST (
20 -- * The 'ST' Monad
21 ST, -- abstract, instance of Functor, Monad, Typeable.
22 runST, -- :: (forall s. ST s a) -> a
23 fixST, -- :: (a -> ST s a) -> ST s a
24
25 -- * Converting 'ST' to 'IO'
26 RealWorld, -- abstract
27 stToIO, -- :: ST RealWorld a -> IO a
28
29 -- * Unsafe Functions
30 unsafeInterleaveST,
31 unsafeIOToST,
32 unsafeSTToIO
33 ) where
34
35 import Control.Monad.ST.Safe
36 import qualified Control.Monad.ST.Unsafe as U
37
38 {-# DEPRECATED unsafeInterleaveST, unsafeIOToST, unsafeSTToIO
39 "Please import from Control.Monad.ST.Unsafe instead; This will be removed in the next release"
40 #-}
41
42 {-# INLINE unsafeInterleaveST #-}
43 unsafeInterleaveST :: ST s a -> ST s a
44 unsafeInterleaveST = U.unsafeInterleaveST
45
46 {-# INLINE unsafeIOToST #-}
47 unsafeIOToST :: IO a -> ST s a
48 unsafeIOToST = U.unsafeIOToST
49
50 {-# INLINE unsafeSTToIO #-}
51 unsafeSTToIO :: ST s a -> IO a
52 unsafeSTToIO = U.unsafeSTToIO
53