| |||||||||||||
| |||||||||||||
| |||||||||||||
Description | |||||||||||||
This module exports a Handle to a file which is parameterized with the IOMode the handle is in. All operations on handles explicitly specify the needed IOMode. This way it is impossible to read from a write-only handle or write to a read-only handle for example. This modules re-exports everything from System.IO so you can just replace: import System.IO with: import System.IO.ExplicitIOModes, change some type signatures and expect everything to type-check. There's one exception to this last statement: If you are using the standard handles stdin, stdout or stderr in a mode which isn't their default mode (R for stdin and W for stdout and stderr) you have to cast these handles to the expected IOMode. | |||||||||||||
Synopsis | |||||||||||||
The IO monad | |||||||||||||
IO (IO) | |||||||||||||
fixIO | |||||||||||||
Files and handles | |||||||||||||
FilePath | |||||||||||||
| |||||||||||||
| |||||||||||||
IO Modes | |||||||||||||
Types that represent the IOMode a Handle can be in. | |||||||||||||
| |||||||||||||
| |||||||||||||
| |||||||||||||
| |||||||||||||
| |||||||||||||
| |||||||||||||
| |||||||||||||
| |||||||||||||
Standard handles | |||||||||||||
These standard handles have concrete IOModes by default which work for the majority of cases. In the rare occasion that you know these handles have different IOModes you can cast them. | |||||||||||||
| |||||||||||||
Wraps: System.IO.stdin. | |||||||||||||
| |||||||||||||
Wraps: System.IO.stdout. | |||||||||||||
| |||||||||||||
Wraps: System.IO.stderr. | |||||||||||||
| |||||||||||||
Cast the IOMode of a handle if the handle supports it. | |||||||||||||
Opening and closing files | |||||||||||||
Opening files | |||||||||||||
| |||||||||||||
Wraps: System.IO.withFile. | |||||||||||||
| |||||||||||||
Wraps: System.IO.openFile. | |||||||||||||
| |||||||||||||
| |||||||||||||
Closing files | |||||||||||||
| |||||||||||||
Wraps: System.IO.hClose. | |||||||||||||
Special cases | |||||||||||||
readFile | |||||||||||||
writeFile | |||||||||||||
appendFile | |||||||||||||
Operations on handles | |||||||||||||
Determining and changing the size of a file | |||||||||||||
| |||||||||||||
Wraps: System.IO.hFileSize. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hSetFileSize. | |||||||||||||
Detecting the end of input | |||||||||||||
| |||||||||||||
Wraps: System.IO.hIsEOF. | |||||||||||||
Buffering operations | |||||||||||||
BufferMode (NoBuffering, LineBuffering, BlockBuffering) | |||||||||||||
| |||||||||||||
Wraps: System.IO.hSetBuffering. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hGetBuffering. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hFlush. | |||||||||||||
Repositioning handles | |||||||||||||
| |||||||||||||
Wraps: System.IO.hGetPosn. | |||||||||||||
hSetPosn | |||||||||||||
HandlePosn (HandlePosn) | |||||||||||||
| |||||||||||||
Wraps: System.IO.hSeek. | |||||||||||||
SeekMode (AbsoluteSeek, RelativeSeek, SeekFromEnd) | |||||||||||||
| |||||||||||||
Wraps: System.IO.hTell. | |||||||||||||
Handle properties | |||||||||||||
| |||||||||||||
Wraps: System.IO.hIsOpen. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hIsClosed. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hIsReadable. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hIsWritable. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hIsSeekable. | |||||||||||||
Terminal operations (not portable: GHC/Hugs only) | |||||||||||||
| |||||||||||||
Wraps: System.IO.hIsTerminalDevice. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hSetEcho. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hGetEcho. | |||||||||||||
Showing handle state (not portable: GHC only) | |||||||||||||
| |||||||||||||
Wraps: System.IO.hShow. | |||||||||||||
Text input and output | |||||||||||||
Text input | |||||||||||||
Note that the following text input operations are polymorphic in the IOMode of the given handle. However the IOModes are restricted to ReadModes only which can be either R or RW. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hWaitForInput. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hReady. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hGetChar. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hGetLine. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hLookAhead. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hGetContents. | |||||||||||||
Text ouput | |||||||||||||
Note that the following text output operations are polymorphic in the IOMode of the given handle. However the IOModes are restricted to WriteModes only which can be either W, A or RW. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hPutChar. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hPutStr. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hPutStrLn. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hPrint. | |||||||||||||
Special cases for standard input and output | |||||||||||||
These functions are also exported by the Prelude. | |||||||||||||
interact | |||||||||||||
putChar | |||||||||||||
putStr | |||||||||||||
putStrLn | |||||||||||||
getChar | |||||||||||||
getLine | |||||||||||||
getContents | |||||||||||||
readIO | |||||||||||||
readLn | |||||||||||||
Binary input and output | |||||||||||||
| |||||||||||||
Wraps: System.IO.withBinaryFile. | |||||||||||||
| |||||||||||||
Wraps: System.IO.openBinaryFile. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hSetBinaryMode. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hPutBuf. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hGetBuf. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hPutBufNonBlocking. | |||||||||||||
| |||||||||||||
Wraps: System.IO.hGetBufNonBlocking. | |||||||||||||
Temporary files | |||||||||||||
| |||||||||||||
Wraps: System.IO.openTempFile. | |||||||||||||
| |||||||||||||
Wraps: System.IO.openBinaryTempFile. | |||||||||||||
Produced by Haddock version 2.4.2 |