Safe Haskell | None |
---|---|
Language | Haskell2010 |
Read and write UTF-8 text files.
- readFile :: Path base File -> IO Text
- tryReadFile :: Path base File -> IO (Either ReadError Text)
- data ReadError
- writeFile :: Path base File -> Text -> IO ()
- tryWriteFile :: Path base File -> Text -> IO (Either WriteError ())
- type WriteError = IOError
- type IOError = IOException
- data UnicodeException :: * = DecodeError String (Maybe Word8)
Reading
readFile :: Path base File -> IO Text Source #
Read the contents of a UTF-8 encoded text file.
May throw IOError
or UnicodeException
. To handle these errors in Either
instead, use tryReadFile
.
Writing
writeFile :: Path base File -> Text -> IO () Source #
Write text to a file in a UTF-8 encoding.
May throw IOError
. To handle this error in Either
instead, use
tryWriteFile
.
tryWriteFile :: Path base File -> Text -> IO (Either WriteError ()) Source #
type WriteError = IOError Source #
Re-exports
type IOError = IOException #
data UnicodeException :: * #
An exception type for representing Unicode encoding errors.
DecodeError String (Maybe Word8) | Could not decode a byte sequence because it was invalid under the given encoding, or ran out of input in mid-decode. |