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