base-4.16.3.0: Basic libraries
Copyright(c) The University of Glasgow 1994-2001
Licensesee libraries/base/LICENSE
Maintainerlibraries@haskell.org
Stabilityinternal
Portabilitynon-portable
Safe HaskellTrustworthy
LanguageHaskell2010

GHC.IO.Handle.Internals

Description

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

Synopsis

Documentation

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

mkFileHandle Source #

Arguments

:: (RawIO dev, 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

mkFileHandleNoFinalizer Source #

Arguments

:: (RawIO dev, 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 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 #

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.

flushCharBuffer :: Handle__ -> IO () Source #

flushes the Char buffer only. Works on all Handles.

hClose_impl :: Handle -> IO () Source #

This function exists temporarily to avoid an unused import warning in bytestring.