GHC.IO.Handle.Internals

Copyright (c) The University of Glasgow 1994-2001
License see libraries/base/LICENSE
Maintainer [email protected]
Stability internal
Portability non-portable
Safe Haskell Trustworthy
Language Haskell2010

Description

This module defines the basic operations on I/O "handles". All of the operations defined here are independent of the underlying device.

withHandle :: String -> Handle -> (Handle__ -> IO (Handle__, a)) -> IO a Source

withHandle' :: String -> Handle -> MVar Handle__ -> (Handle__ -> IO (Handle__, a)) -> IO a Source

withHandle_ :: String -> Handle -> (Handle__ -> IO a) -> IO a Source

withHandle__' :: String -> Handle -> MVar Handle__ -> (Handle__ -> IO Handle__) -> IO () Source

withHandle_' :: String -> Handle -> MVar Handle__ -> (Handle__ -> IO a) -> IO a Source

withAllHandles__ :: String -> Handle -> (Handle__ -> IO Handle__) -> IO () Source

wantWritableHandle :: String -> Handle -> (Handle__ -> IO a) -> IO a Source

wantReadableHandle :: String -> Handle -> (Handle__ -> IO (Handle__, a)) -> IO a Source

wantReadableHandle_ :: String -> Handle -> (Handle__ -> IO a) -> IO a Source

wantSeekableHandle :: String -> Handle -> (Handle__ -> IO a) -> IO a Source

mkHandle :: (IODevice dev, BufferedIO dev, Typeable dev) => dev -> FilePath -> HandleType -> Bool -> Maybe TextEncoding -> NewlineMode -> Maybe HandleFinalizer -> Maybe (MVar Handle__) -> IO Handle Source

mkFileHandle Source

Arguments

:: (IODevice dev, BufferedIO dev, Typeable dev)
=> dev

the underlying IO device, which must support IODevice, BufferedIO and Typeable

-> FilePath

a string describing the Handle, e.g. the file path for a file. Used in error messages.

-> IOMode
-> Maybe TextEncoding
-> NewlineMode
-> IO Handle

makes a new Handle

mkDuplexHandle :: (IODevice dev, BufferedIO dev, Typeable dev) => dev -> FilePath -> Maybe TextEncoding -> NewlineMode -> IO Handle Source

like mkFileHandle, except that a Handle is created with two independent buffers, one for reading and one for writing. Used for full-duplex streams, such as network sockets.

openTextEncoding :: Maybe TextEncoding -> HandleType -> (forall es ds. Maybe (TextEncoder es) -> Maybe (TextDecoder ds) -> IO a) -> IO a Source

closeTextCodecs :: Handle__ -> IO () Source

initBufferState :: HandleType -> BufferState Source

dEFAULT_CHAR_BUFFER_SIZE :: Int Source

flushBuffer :: Handle__ -> IO () Source

syncs the file with the buffer, including moving the file pointer backwards in the case of a read buffer. This can fail on a non-seekable read Handle.

flushWriteBuffer :: Handle__ -> IO () Source

flushCharReadBuffer :: Handle__ -> IO () Source

flushCharBuffer :: Handle__ -> IO () Source

flushes the Char buffer only. Works on all Handles.

flushByteReadBuffer :: Handle__ -> IO () Source

flushByteWriteBuffer :: Handle__ -> IO () Source

readTextDevice :: Handle__ -> CharBuffer -> IO CharBuffer Source

writeCharBuffer :: Handle__ -> CharBuffer -> IO () Source

readTextDeviceNonBlocking :: Handle__ -> CharBuffer -> IO CharBuffer Source

decodeByteBuf :: Handle__ -> CharBuffer -> IO CharBuffer Source

augmentIOError :: IOException -> String -> Handle -> IOException Source

ioe_closedHandle :: IO a Source

ioe_semiclosedHandle :: IO a Source

ioe_EOF :: IO a Source

ioe_notReadable :: IO a Source

ioe_notWritable :: IO a Source

ioe_finalizedHandle :: FilePath -> Handle__ Source

ioe_bufsiz :: Int -> IO a Source

hClose_help :: Handle__ -> IO (Handle__, Maybe SomeException) Source

hLookAhead_ :: Handle__ -> IO Char Source

type HandleFinalizer = FilePath -> MVar Handle__ -> IO () Source

handleFinalizer :: FilePath -> MVar Handle__ -> IO () Source

debugIO :: String -> IO () Source

© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/8.10.2/docs/html/libraries/base-4.14.1.0/GHC-IO-Handle-Internals.html