Haskell Core Libraries (base package)ParentContentsIndex
GHC.Handle
Portability non-portable
Stability internal
Maintainer libraries@haskell.org
Description
This module defines the basic operations on I/O "handles".
Synopsis
withHandle :: String -> Handle -> (Handle__ -> IO (Handle__, a)) -> IO a
withHandle' :: String -> Handle -> MVar Handle__ -> (Handle__ -> IO (Handle__, a)) -> IO a
withHandle_ :: String -> Handle -> (Handle__ -> IO a) -> IO a
wantWritableHandle :: String -> Handle -> (Handle__ -> IO a) -> IO a
wantReadableHandle :: String -> Handle -> (Handle__ -> IO a) -> IO a
wantSeekableHandle :: String -> Handle -> (Handle__ -> IO a) -> IO a
newEmptyBuffer :: RawBuffer -> BufferState -> Int -> Buffer
allocateBuffer :: Int -> BufferState -> IO Buffer
readCharFromBuffer :: RawBuffer -> Int -> IO (Char, Int)
writeCharIntoBuffer :: RawBuffer -> Int -> Char -> IO Int
flushWriteBufferOnly :: Handle__ -> IO ()
flushWriteBuffer :: FD -> Bool -> Buffer -> IO Buffer
flushReadBuffer :: FD -> Buffer -> IO Buffer
fillReadBuffer :: FD -> Bool -> Bool -> Buffer -> IO Buffer
read_off :: FD -> Bool -> Ptr CChar -> Int -> CInt -> IO CInt
read_off_ba :: FD -> Bool -> RawBuffer -> Int -> CInt -> IO CInt
write_off :: CInt -> Bool -> Ptr CChar -> Int -> CInt -> IO CInt
write_off_ba :: CInt -> Bool -> RawBuffer -> Int -> CInt -> IO CInt
ioe_closedHandle :: IO a
ioe_EOF :: IO a
ioe_notReadable :: IO a
ioe_notWritable :: IO a
stdin :: Handle
stdout :: Handle
stderr :: Handle
data IOMode
= ReadMode
| WriteMode
| AppendMode
| ReadWriteMode
data IOModeEx
= BinaryMode IOMode
| TextMode IOMode
openFile :: FilePath -> IOMode -> IO Handle
openFileEx :: FilePath -> IOModeEx -> IO Handle
openFd :: FD -> Maybe FDType -> FilePath -> IOMode -> Bool -> Bool -> IO Handle
hFileSize :: Handle -> IO Integer
hIsEOF :: Handle -> IO Bool
isEOF :: IO Bool
hLookAhead :: Handle -> IO Char
hSetBuffering :: Handle -> BufferMode -> IO ()
hSetBinaryMode :: Handle -> Bool -> IO ()
hFlush :: Handle -> IO ()
hClose :: Handle -> IO ()
hClose_help :: Handle__ -> IO Handle__
data HandlePosn = HandlePosn Handle HandlePosition
hGetPosn :: Handle -> IO HandlePosn
hSetPosn :: HandlePosn -> IO ()
data SeekMode
= AbsoluteSeek
| RelativeSeek
| SeekFromEnd
hSeek :: Handle -> SeekMode -> Integer -> IO ()
hTell :: Handle -> IO Integer
hIsOpen :: Handle -> IO Bool
hIsClosed :: Handle -> IO Bool
hIsReadable :: Handle -> IO Bool
hIsWritable :: Handle -> IO Bool
hGetBuffering :: Handle -> IO BufferMode
hIsSeekable :: Handle -> IO Bool
hSetEcho :: Handle -> Bool -> IO ()
hGetEcho :: Handle -> IO Bool
hIsTerminalDevice :: Handle -> IO Bool
Documentation
withHandle :: String -> Handle -> (Handle__ -> IO (Handle__, a)) -> IO a
withHandle' :: String -> Handle -> MVar Handle__ -> (Handle__ -> IO (Handle__, a)) -> IO a
withHandle_ :: String -> Handle -> (Handle__ -> IO a) -> IO a
wantWritableHandle :: String -> Handle -> (Handle__ -> IO a) -> IO a
wantReadableHandle :: String -> Handle -> (Handle__ -> IO a) -> IO a
wantSeekableHandle :: String -> Handle -> (Handle__ -> IO a) -> IO a
newEmptyBuffer :: RawBuffer -> BufferState -> Int -> Buffer
allocateBuffer :: Int -> BufferState -> IO Buffer
readCharFromBuffer :: RawBuffer -> Int -> IO (Char, Int)
writeCharIntoBuffer :: RawBuffer -> Int -> Char -> IO Int
flushWriteBufferOnly :: Handle__ -> IO ()
flushWriteBuffer :: FD -> Bool -> Buffer -> IO Buffer
flushReadBuffer :: FD -> Buffer -> IO Buffer
fillReadBuffer :: FD -> Bool -> Bool -> Buffer -> IO Buffer
read_off :: FD -> Bool -> Ptr CChar -> Int -> CInt -> IO CInt
read_off_ba :: FD -> Bool -> RawBuffer -> Int -> CInt -> IO CInt
write_off :: CInt -> Bool -> Ptr CChar -> Int -> CInt -> IO CInt
write_off_ba :: CInt -> Bool -> RawBuffer -> Int -> CInt -> IO CInt
ioe_closedHandle :: IO a
ioe_EOF :: IO a
ioe_notReadable :: IO a
ioe_notWritable :: IO a
stdin :: Handle
stdout :: Handle
stderr :: Handle
data IOMode
Constructors
ReadMode
WriteMode
AppendMode
ReadWriteMode
data IOModeEx
Constructors
BinaryMode IOMode
TextMode IOMode
openFile :: FilePath -> IOMode -> IO Handle
openFileEx :: FilePath -> IOModeEx -> IO Handle
openFd :: FD -> Maybe FDType -> FilePath -> IOMode -> Bool -> Bool -> IO Handle
hFileSize :: Handle -> IO Integer
hIsEOF :: Handle -> IO Bool
isEOF :: IO Bool
hLookAhead :: Handle -> IO Char
hSetBuffering :: Handle -> BufferMode -> IO ()
hSetBinaryMode :: Handle -> Bool -> IO ()
On Windows, reading a file in text mode (which is the default) will translate CRLF to LF, and writing will translate LF to CRLF. This is usually what you want with text files. With binary files this is undesirable; also, as usual under Microsoft operating systems, text mode treats control-Z as EOF. Setting binary mode using hSetBinaryMode turns off all special treatment of end-of-line and end-of-file characters.
hFlush :: Handle -> IO ()
hClose :: Handle -> IO ()
hClose_help :: Handle__ -> IO Handle__
data HandlePosn
Constructors
HandlePosn Handle HandlePosition
Instances
Eq HandlePosn
Show HandlePosn
hGetPosn :: Handle -> IO HandlePosn
hSetPosn :: HandlePosn -> IO ()
data SeekMode
Constructors
AbsoluteSeek
RelativeSeek
SeekFromEnd
hSeek :: Handle -> SeekMode -> Integer -> IO ()
hTell :: Handle -> IO Integer
hIsOpen :: Handle -> IO Bool
hIsClosed :: Handle -> IO Bool
hIsReadable :: Handle -> IO Bool
hIsWritable :: Handle -> IO Bool
hGetBuffering :: Handle -> IO BufferMode
hIsSeekable :: Handle -> IO Bool
hSetEcho :: Handle -> Bool -> IO ()
hGetEcho :: Handle -> IO Bool
hIsTerminalDevice :: Handle -> IO Bool
Produced by Haddock version 0.4