base-4.14.1.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

:: (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 #

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.