cf05c787447202fa8e79284b646cf4300c084209
[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
20 module GHC.IOBase {-# DEPRECATED "use GHC.IO instead" #-} (
21 IO(..), unIO, failIO, liftIO, bindIO, thenIO, returnIO,
22 unsafePerformIO, unsafeInterleaveIO,
23 unsafeDupablePerformIO, unsafeDupableInterleaveIO,
24 noDuplicate,
25
26 -- To and from from ST
27 stToIO, ioToST, unsafeIOToST, unsafeSTToIO,
28
29 -- References
30 IORef(..), newIORef, readIORef, writeIORef,
31 IOArray(..), newIOArray, readIOArray, writeIOArray, unsafeReadIOArray, unsafeWriteIOArray,
32 MVar(..),
33
34 -- Handles, file descriptors,
35 FilePath,
36 Handle(..), Handle__(..), HandleType(..), IOMode(..), FD,
37 isReadableHandleType, isWritableHandleType, isReadWriteHandleType, showHandle,
38
39 -- Buffers
40 -- Buffer(..), RawBuffer, BufferState(..),
41 BufferList(..), BufferMode(..),
42 --bufferIsWritable, bufferEmpty, bufferFull,
43
44 -- Exceptions
45 Exception(..), ArithException(..), AsyncException(..), ArrayException(..),
46 stackOverflow, heapOverflow, ioException,
47 IOError, IOException(..), IOErrorType(..), ioError, userError,
48 ExitCode(..),
49 throwIO, block, unblock, blocked, catchAny, catchException,
50 evaluate,
51 ErrorCall(..), AssertionFailed(..), assertError, untangle,
52 BlockedOnDeadMVar(..), BlockedIndefinitely(..), Deadlock(..),
53 blockedOnDeadMVar, blockedIndefinitely
54 ) where
55
56 import GHC.Base
57 import GHC.Exception
58 import GHC.IO
59 import GHC.IO.Handle.Types
60 import GHC.IO.IOMode
61 import GHC.IO.Exception
62 import GHC.IOArray
63 import GHC.IORef
64 import GHC.MVar
65 import Foreign.C.Types
66 import Data.Typeable
67
68 type FD = CInt
69
70 -- Backwards compat: this was renamed to BlockedIndefinitelyOnMVar
71 data BlockedOnDeadMVar = BlockedOnDeadMVar
72 deriving Typeable
73
74 instance Exception BlockedOnDeadMVar
75
76 instance Show BlockedOnDeadMVar where
77 showsPrec _ BlockedOnDeadMVar = showString "thread blocked indefinitely"
78
79 blockedOnDeadMVar :: SomeException -- for the RTS
80 blockedOnDeadMVar = toException BlockedOnDeadMVar
81
82
83 -- Backwards compat: this was renamed to BlockedIndefinitelyOnSTM
84 data BlockedIndefinitely = BlockedIndefinitely
85 deriving Typeable
86
87 instance Exception BlockedIndefinitely
88
89 instance Show BlockedIndefinitely where
90 showsPrec _ BlockedIndefinitely = showString "thread blocked indefinitely"
91
92 blockedIndefinitely :: SomeException -- for the RTS
93 blockedIndefinitely = toException BlockedIndefinitely