| Copyright | (c) The University of Glasgow 1994-2001 |
|---|---|
| License | see libraries/base/LICENSE |
| Maintainer | [email protected] |
| Stability | internal |
| Portability | non-portable |
| Safe Haskell | Safe |
| Language | Haskell2010 |
This module defines the basic operations on I/O "handles". All of the operations defined here are independent of the underlying device.
The API of this module is unstable and not meant to be consumed by the general public. If you absolutely must depend on it, make sure to use a tight upper bound, e.g., base < 4.X rather than base < 5, because the interface can change rapidly without much warning.
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 :: (RawIO dev, IODevice dev, BufferedIO dev, Typeable dev) => dev -> FilePath -> HandleType -> Bool -> Maybe TextEncoding -> NewlineMode -> Maybe HandleFinalizer -> Maybe (MVar Handle__) -> IO Handle Source
| :: (RawIO dev, IODevice dev, BufferedIO dev, Typeable dev) | |
| => dev | the underlying IO device, which must support |
| -> FilePath | a string describing the |
| -> IOMode | |
| -> Maybe TextEncoding | |
| -> NewlineMode | |
| -> IO Handle |
makes a new Handle
mkFileHandleNoFinalizer Source
| :: (RawIO dev, IODevice dev, BufferedIO dev, Typeable dev) | |
| => dev | the underlying IO device, which must support |
| -> FilePath | a string describing the |
| -> IOMode | |
| -> Maybe TextEncoding | |
| -> NewlineMode | |
| -> IO Handle |
makes a new Handle without a finalizer.
mkDuplexHandle :: (RawIO dev, 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.
mkDuplexHandleNoFinalizer :: (RawIO dev, 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.
addHandleFinalizer :: Handle -> HandleFinalizer -> IO () Source
Add a finalizer to a Handle. Specifically, the finalizer will be added to the MVar of a file handle or the write-side MVar of a duplex handle. See Handle Finalizers for details.
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_notReadable :: IO a Source
ioe_notWritable :: IO a Source
ioe_finalizedHandle :: FilePath -> Handle__ Source
ioe_bufsiz :: Int -> IO a Source
hClose_impl :: Handle -> IO () Source
This function exists temporarily to avoid an unused import warning in bytestring.
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
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/9.12.1/docs/libraries/base-4.21.0.0-8e62/GHC-IO-Handle-Internals.html