License | BSD-style |
---|---|
Maintainer | Vincent Hanquez <vincent@snarc.org> |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Foundation.IO
Description
IO Routine
Synopsis
- putStrLn :: String -> IO ()
- putStr :: String -> IO ()
- stdin :: Handle
- stdout :: Handle
- data IOMode
- openFile :: FilePath -> IOMode -> IO Handle
- closeFile :: Handle -> IO ()
- withFile :: FilePath -> IOMode -> (Handle -> IO r) -> IO r
- hGet :: Handle -> Int -> IO (UArray Word8)
- hPut :: Handle -> UArray Word8 -> IO ()
- readFile :: FilePath -> IO (UArray Word8)
Terminal
File
Constructors
ReadMode | |
WriteMode | |
AppendMode | |
ReadWriteMode |
openFile :: FilePath -> IOMode -> IO Handle Source #
list the file name in the given FilePath directory
TODO: error management and not implemented yet getDirectory :: FilePath -> IO [FileName] getDirectory = undefined
Open a new handle on the file
withFile :: FilePath -> IOMode -> (Handle -> IO r) -> IO r Source #
opens a file using the modewithFile
filepath mode act
and run act
. the by-product handle will be closed when act finish,
either normally or through an exception.
The value returned is the result of act@
hGet :: Handle -> Int -> IO (UArray Word8) Source #
Read binary data directly from the specified Handle
.
First argument is the Handle to read from, and the second is the number of bytes to read. It returns the bytes read, up to the specified size, or an empty array if EOF has been reached.
hGet
is implemented in terms of hGetBuf
.