-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | File handles with explicit IOModes -- -- The module System.IO.ExplicitIOModes 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. @package explicit-iomodes @version 0.1 -- | 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. module System.IO.ExplicitIOModes -- | A handle to a file with an explicit IOMode. -- -- Wraps: System.IO.Handle. data Handle ioMode -- | Read only. data R -- | Write only. data W -- | Append. data A -- | Read and write. data RW -- | Wraps: System.IO.stdin. stdin :: Handle R -- | Wraps: System.IO.stdout. stdout :: Handle W -- | Wraps: System.IO.stderr. stderr :: Handle W -- | Cast the IOMode of a handle if the handle supports it. cast :: (CheckMode castedIOMode) => Handle anyIOMode -> IO (Maybe (Handle castedIOMode)) -- | Wraps: System.IO.withFile. withFile :: FilePath -> IOMode ioMode -> (Handle ioMode -> IO r) -> IO r -- | Wraps: System.IO.openFile. openFile :: FilePath -> IOMode ioMode -> IO (Handle ioMode) -- | The IOMode GADT which for each constructor specifies the associated -- IOMode type. -- -- Also see: System.IO.IOMode. data IOMode ioMode ReadMode :: IOMode R WriteMode :: IOMode W AppendMode :: IOMode A ReadWriteMode :: IOMode RW -- | Wraps: System.IO.hClose. hClose :: Handle ioMode -> IO () -- | Wraps: System.IO.hFileSize. hFileSize :: Handle ioMode -> IO Integer -- | Wraps: System.IO.hSetFileSize. hSetFileSize :: Handle ioMode -> Integer -> IO () -- | Wraps: System.IO.hIsEOF. hIsEOF :: (ReadModes ioMode) => Handle ioMode -> IO Bool -- | Wraps: System.IO.hSetBuffering. hSetBuffering :: Handle ioMode -> BufferMode -> IO () -- | Wraps: System.IO.hGetBuffering. hGetBuffering :: Handle ioMode -> IO BufferMode -- | Wraps: System.IO.hFlush. hFlush :: Handle ioMode -> IO () -- | Wraps: System.IO.hGetPosn. hGetPosn :: Handle ioMode -> IO HandlePosn -- | Wraps: System.IO.hSeek. hSeek :: Handle ioMode -> SeekMode -> Integer -> IO () -- | Wraps: System.IO.hTell. hTell :: Handle ioMode -> IO Integer -- | Wraps: System.IO.hIsOpen. hIsOpen :: Handle ioMode -> IO Bool -- | Wraps: System.IO.hIsClosed. hIsClosed :: Handle ioMode -> IO Bool -- | Wraps: System.IO.hIsReadable. hIsReadable :: Handle ioMode -> IO Bool -- | Wraps: System.IO.hIsWritable. hIsWritable :: Handle ioMode -> IO Bool -- | Wraps: System.IO.hIsSeekable. hIsSeekable :: Handle ioMode -> IO Bool -- | Wraps: System.IO.hIsTerminalDevice. hIsTerminalDevice :: Handle ioMode -> IO Bool -- | Wraps: System.IO.hSetEcho. hSetEcho :: Handle ioMode -> Bool -> IO () -- | Wraps: System.IO.hGetEcho. hGetEcho :: Handle ioMode -> IO Bool -- | Wraps: System.IO.hShow. hShow :: Handle ioMode -> IO String -- | Wraps: System.IO.hWaitForInput. hWaitForInput :: (ReadModes ioMode) => Handle ioMode -> Int -> IO Bool -- | Wraps: System.IO.hReady. hReady :: (ReadModes ioMode) => Handle ioMode -> IO Bool -- | Wraps: System.IO.hGetChar. hGetChar :: (ReadModes ioMode) => Handle ioMode -> IO Char -- | Wraps: System.IO.hGetLine. hGetLine :: (ReadModes ioMode) => Handle ioMode -> IO String -- | Wraps: System.IO.hLookAhead. hLookAhead :: (ReadModes ioMode) => Handle ioMode -> IO Char -- | Wraps: System.IO.hGetContents. hGetContents :: (ReadModes ioMode) => Handle ioMode -> IO String -- | Wraps: System.IO.hPutChar. hPutChar :: (WriteModes ioMode) => Handle ioMode -> Char -> IO () -- | Wraps: System.IO.hPutStr. hPutStr :: (WriteModes ioMode) => Handle ioMode -> String -> IO () -- | Wraps: System.IO.hPutStrLn. hPutStrLn :: (WriteModes ioMode) => Handle ioMode -> String -> IO () -- | Wraps: System.IO.hPrint. hPrint :: (WriteModes ioMode, Show a) => Handle ioMode -> a -> IO () -- | Wraps: System.IO.withBinaryFile. withBinaryFile :: FilePath -> IOMode ioMode -> (Handle ioMode -> IO r) -> IO r -- | Wraps: System.IO.openBinaryFile. openBinaryFile :: FilePath -> IOMode ioMode -> IO (Handle ioMode) -- | Wraps: System.IO.hSetBinaryMode. hSetBinaryMode :: Handle ioMode -> Bool -> IO () -- | Wraps: System.IO.hPutBuf. hPutBuf :: (WriteModes ioMode) => Handle ioMode -> Ptr a -> Int -> IO () -- | Wraps: System.IO.hGetBuf. hGetBuf :: (ReadModes ioMode) => Handle ioMode -> Ptr a -> Int -> IO Int -- | Wraps: System.IO.hPutBufNonBlocking. hPutBufNonBlocking :: (WriteModes ioMode) => Handle ioMode -> Ptr a -> Int -> IO Int -- | Wraps: System.IO.hGetBufNonBlocking. hGetBufNonBlocking :: (ReadModes ioMode) => Handle ioMode -> Ptr a -> Int -> IO Int -- | Wraps: System.IO.openTempFile. openTempFile :: FilePath -> String -> IO (FilePath, Handle RW) -- | Wraps: System.IO.openBinaryTempFile. openBinaryTempFile :: FilePath -> String -> IO (FilePath, Handle RW) instance Typeable1 Handle instance Show (Handle ioMode) instance Eq (Handle ioMode) instance Show (IOMode ioMode) instance Ord (IOMode ioMode) instance Eq (IOMode ioMode) instance CheckMode RW instance CheckMode A instance CheckMode W instance CheckMode R instance WriteModes RW instance WriteModes A instance WriteModes W instance ReadModes RW instance ReadModes R