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