Update base for latest Safe Haskell.
[packages/base.git] / GHC / IOBase.hs
1 {-# LANGUAGE Unsafe #-}
2 {-# LANGUAGE DeriveDataTypeable #-}
3 {-# OPTIONS_HADDOCK hide #-}
4
5 -----------------------------------------------------------------------------
6 -- |
7 -- Module : GHC.IOBase
8 -- Copyright : (c) The University of Glasgow 1994-2009
9 -- License : see libraries/base/LICENSE
10 --
11 -- Maintainer : cvs-ghc@haskell.org
12 -- Stability : internal
13 -- Portability : non-portable (GHC Extensions)
14 --
15 -- Backwards-compatibility interface
16 --
17 -----------------------------------------------------------------------------
18
19 module GHC.IOBase {-# DEPRECATED "use GHC.IO instead" #-} (
20 IO(..), unIO, failIO, liftIO, bindIO, thenIO, returnIO,
21 unsafePerformIO, unsafeInterleaveIO,
22 unsafeDupablePerformIO, unsafeDupableInterleaveIO,
23 noDuplicate,
24
25 -- To and from from ST
26 stToIO, ioToST, unsafeIOToST, unsafeSTToIO,
27
28 -- References
29 IORef(..), newIORef, readIORef, writeIORef,
30 IOArray(..), newIOArray, readIOArray, writeIOArray, unsafeReadIOArray, unsafeWriteIOArray,
31 MVar(..),
32
33 -- Handles, file descriptors,
34 FilePath,
35 Handle(..), Handle__(..), HandleType(..), IOMode(..), FD,
36 isReadableHandleType, isWritableHandleType, isReadWriteHandleType, showHandle,
37
38 -- Buffers
39 -- Buffer(..), RawBuffer, BufferState(..),
40 BufferList(..), BufferMode(..),
41 --bufferIsWritable, bufferEmpty, bufferFull,
42
43 -- Exceptions
44 Exception(..), ArithException(..), AsyncException(..), ArrayException(..),
45 stackOverflow, heapOverflow, ioException,
46 IOError, IOException(..), IOErrorType(..), ioError, userError,
47 ExitCode(..),
48 throwIO, block, unblock, blocked, catchAny, catchException,
49 evaluate,
50 ErrorCall(..), AssertionFailed(..), assertError, untangle,
51 BlockedOnDeadMVar(..), BlockedIndefinitely(..), Deadlock(..),
52 blockedOnDeadMVar, blockedIndefinitely
53 ) where
54
55 import GHC.Base
56 import GHC.Exception
57 import GHC.IO
58 import GHC.IO.Handle.Types
59 import GHC.IO.IOMode
60 import GHC.IO.Exception
61 import GHC.IOArray
62 import GHC.IORef
63 import GHC.MVar
64 import Foreign.C.Types
65 import Data.Typeable
66
67 type FD = CInt
68
69 -- Backwards compat: this was renamed to BlockedIndefinitelyOnMVar
70 data BlockedOnDeadMVar = BlockedOnDeadMVar
71 deriving Typeable
72
73 instance Exception BlockedOnDeadMVar
74
75 instance Show BlockedOnDeadMVar where
76 showsPrec _ BlockedOnDeadMVar = showString "thread blocked indefinitely"
77
78 blockedOnDeadMVar :: SomeException -- for the RTS
79 blockedOnDeadMVar = toException BlockedOnDeadMVar
80
81
82 -- Backwards compat: this was renamed to BlockedIndefinitelyOnSTM
83 data BlockedIndefinitely = BlockedIndefinitely
84 deriving Typeable
85
86 instance Exception BlockedIndefinitely
87
88 instance Show BlockedIndefinitely where
89 showsPrec _ BlockedIndefinitely = showString "thread blocked indefinitely"
90
91 blockedIndefinitely :: SomeException -- for the RTS
92 blockedIndefinitely = toException BlockedIndefinitely
93