Community
Modules 50

Data.Text.IO.Utf8

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.

File-at-a-time operations

readFile :: FilePath -> IO Text

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 ()

Write a string to a file. The file is truncated to zero length before writing begins.

appendFile :: FilePath -> Text -> IO ()

Write a string to the end of a file.

Operations on handles

hGetContents :: Handle -> IO Text

Read the remaining contents of a Handle as a string.

hGetLine :: Handle -> IO Text

Read a single line from a handle.

hPutStr :: Handle -> Text -> IO ()

Write a string to a handle.

hPutStrLn :: Handle -> Text -> IO ()

Write a string to a handle, followed by a newline.

Special cases for standard input and output

interact :: (Text -> Text) -> IO ()

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

Read all user input on stdin as a single string.

getLine :: IO Text

Read a single line of user input from stdin.

putStr :: Text -> IO ()

Write a string to stdout.

putStrLn :: Text -> IO ()

Write a string to stdout, followed by a newline.

Portability
GHC
License
BSD-style
Build record and source files

Community contribution. The service has not verified this documentation. The generator reported 2 diagnostics.

Target: Linux on x86-64. Some inferred types and resolved links are not available.

Generator: aihc-haddock-858b1951-web-1

Metadata snapshot: 0b0724abd14577f7a6c8172d62e3e1c0808feb114d4d379402e17f37e3c7801e

Open the dependency plan · Download the documentation model

Import a package

Enter a package name and an exact version from Hackage. The site contains imported versions only.