1 % -----------------------------------------------------------------------------
2 % $Id: IO.lhs,v 1.42 2001/06/01 13:06:01 sewardj Exp $
4 % (c) The University of Glasgow, 1994-2000
7 \section[IO]{Module @IO@}
9 Implementation of the standard Haskell IO interface, see
10 @http://haskell.org/onlinelibrary/io.html@ for the official
15 Handle, -- abstract, instance of: Eq, Show.
16 HandlePosn(..), -- abstract, instance of: Eq, Show.
18 IOMode(ReadMode,WriteMode,AppendMode,ReadWriteMode),
19 BufferMode(NoBuffering,LineBuffering,BlockBuffering),
20 SeekMode(AbsoluteSeek,RelativeSeek,SeekFromEnd),
22 stdin, stdout, stderr, -- :: Handle
24 openFile, -- :: FilePath -> IOMode -> IO Handle
25 hClose, -- :: Handle -> IO ()
26 hFileSize, -- :: Handle -> IO Integer
27 hIsEOF, -- :: Handle -> IO Bool
30 hSetBuffering, -- :: Handle -> BufferMode -> IO ()
31 hGetBuffering, -- :: Handle -> IO BufferMode
32 hSetBinaryMode, -- :: Handle -> Bool -> IO ()
33 hFlush, -- :: Handle -> IO ()
34 hGetPosn, -- :: Handle -> IO HandlePosn
35 hSetPosn, -- :: Handle -> HandlePosn -> IO ()
36 hSeek, -- :: Handle -> SeekMode -> Integer -> IO ()
37 hWaitForInput, -- :: Handle -> Int -> IO Bool
38 hReady, -- :: Handle -> IO Bool
39 hGetChar, -- :: Handle -> IO Char
40 hGetLine, -- :: Handle -> IO [Char]
41 hLookAhead, -- :: Handle -> IO Char
42 hGetContents, -- :: Handle -> IO [Char]
43 hPutChar, -- :: Handle -> Char -> IO ()
44 hPutStr, -- :: Handle -> [Char] -> IO ()
45 hPutStrLn, -- :: Handle -> [Char] -> IO ()
46 hPrint, -- :: Show a => Handle -> a -> IO ()
47 hIsOpen, hIsClosed, -- :: Handle -> IO Bool
48 hIsReadable, hIsWritable, -- :: Handle -> IO Bool
49 hIsSeekable, -- :: Handle -> IO Bool
51 isAlreadyExistsError, isDoesNotExistError, -- :: IOError -> Bool
52 isAlreadyInUseError, isFullError,
53 isEOFError, isIllegalOperation,
54 isPermissionError, isUserError,
56 ioeGetErrorString, -- :: IOError -> String
57 ioeGetHandle, -- :: IOError -> Maybe Handle
58 ioeGetFileName, -- :: IOError -> Maybe FilePath
60 try, -- :: IO a -> IO (Either IOError a)
61 bracket, -- :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c
62 bracket_, -- :: IO a -> (a -> IO b) -> IO c -> IO c
64 -- Non-standard extension (but will hopefully become standard with 1.5) is
65 -- to export the Prelude io functions via IO (in addition to exporting them
66 -- from the prelude...for now.)
68 FilePath, -- :: String
70 ioError, -- :: IOError -> IO a
71 userError, -- :: String -> IOError
72 catch, -- :: IO a -> (IOError -> IO a) -> IO a
73 interact, -- :: (String -> String) -> IO ()
75 putChar, -- :: Char -> IO ()
76 putStr, -- :: String -> IO ()
77 putStrLn, -- :: String -> IO ()
78 print, -- :: Show a => a -> IO ()
79 getChar, -- :: IO Char
80 getLine, -- :: IO String
81 getContents, -- :: IO String
82 readFile, -- :: FilePath -> IO String
83 writeFile, -- :: FilePath -> String -> IO ()
84 appendFile, -- :: FilePath -> String -> IO ()
85 readIO, -- :: Read a => String -> IO a
86 readLn, -- :: Read a => IO a
90 import PrelIOBase -- Together these four Prelude modules define
92 import PrelHandle -- all the stuff exported by IO for the GHC version