{-# LANGUAGE Trustworthy #-} {-# LANGUAGE CPP, NoImplicitPrelude, CApiFFI #-} ----------------------------------------------------------------------------- -- | -- Module : System.IO -- Copyright : (c) The University of Glasgow 2001 -- License : BSD-style (see the file libraries/base/LICENSE) -- -- Maintainer : libraries@haskell.org -- Stability : stable -- Portability : portable -- -- The standard IO library. -- ----------------------------------------------------------------------------- module System.IO ( -- * The IO monad IO, fixIO, -- * Files and handles FilePath, Handle, -- abstract, instance of: Eq, Show. -- | GHC note: a 'Handle' will be automatically closed when the garbage -- collector detects that it has become unreferenced by the program. -- However, relying on this behaviour is not generally recommended: -- the garbage collector is unpredictable. If possible, use -- an explicit 'hClose' to close 'Handle's when they are no longer -- required. GHC does not currently attempt to free up file -- descriptors when they have run out, it is your responsibility to -- ensure that this doesn't happen. -- ** Standard handles -- | Three handles are allocated during program initialisation, -- and are initially open. stdin, stdout, stderr, -- * Opening and closing files -- ** Opening files withFile, openFile, IOMode(ReadMode,WriteMode,AppendMode,ReadWriteMode), -- ** Closing files hClose, -- ** Special cases -- | These functions are also exported by the "Prelude". readFile, readFile', writeFile, appendFile, -- ** File locking -- $locking -- * Operations on handles -- ** Determining and changing the size of a file hFileSize, hSetFileSize, -- ** Detecting the end of input hIsEOF, isEOF, -- ** Buffering operations BufferMode(NoBuffering,LineBuffering,BlockBuffering), hSetBuffering, hGetBuffering, hFlush, -- ** Repositioning handles hGetPosn, hSetPosn, HandlePosn, -- abstract, instance of: Eq, Show. hSeek, SeekMode(AbsoluteSeek,RelativeSeek,SeekFromEnd), hTell, -- ** Handle properties hIsOpen, hIsClosed, hIsReadable, hIsWritable, hIsSeekable, -- ** Terminal operations (not portable: GHC only) hIsTerminalDevice, hSetEcho, hGetEcho, -- ** Showing handle state (not portable: GHC only) hShow, -- * Text input and output -- ** Text input hWaitForInput, hReady, hGetChar, hGetLine, hLookAhead, hGetContents, hGetContents', -- ** Text output hPutChar, hPutStr, hPutStrLn, hPrint, -- ** Special cases for standard input and output -- | These functions are also exported by the "Prelude". interact, putChar, putStr, putStrLn, print, getChar, getLine, getContents, getContents', readIO, readLn, -- * Binary input and output withBinaryFile, openBinaryFile, hSetBinaryMode, hPutBuf, hGetBuf, hGetBufSome, hPutBufNonBlocking, hGetBufNonBlocking, -- * Temporary files openTempFile, openBinaryTempFile, openTempFileWithDefaultPermissions,