License | BSD-style |
---|---|
Portability | GHC |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Efficient UTF-8 support for text I/O.
Unlike Data.Text.IO
, these functions do not depend on the locale
and do not do line ending conversion.
Synopsis
- readFile :: FilePath -> IO Text
- writeFile :: FilePath -> Text -> IO ()
- appendFile :: FilePath -> Text -> IO ()
- hGetContents :: Handle -> IO Text
- hGetLine :: Handle -> IO Text
- hPutStr :: Handle -> Text -> IO ()
- hPutStrLn :: Handle -> Text -> IO ()
- interact :: (Text -> Text) -> IO ()
- getContents :: IO Text
- getLine :: IO Text
- putStr :: Text -> IO ()
- putStrLn :: Text -> IO ()
File-at-a-time operations
readFile :: FilePath -> IO Text Source #
The readFile
function reads a file and returns the contents of
the file as a string. The entire file is read strictly, as with
getContents
.
writeFile :: FilePath -> Text -> IO () Source #
Write a string to a file. The file is truncated to zero length before writing begins.
Operations on handles
Special cases for standard input and output
interact :: (Text -> Text) -> IO () Source #
The interact
function takes a function of type Text -> Text
as its argument. The entire input from the standard input device is
passed to this function as its argument, and the resulting string
is output on the standard output device.
getContents :: IO Text Source #
Read all user input on stdin
as a single string.