Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
IO utilities
Synopsis
- ioWithFileBytes :: Text -> (ByteString -> IO a) -> IO a
- ioWithFileText :: Text -> (Text -> IO a) -> IO a
Documentation
ioWithFileBytes :: Text -> (ByteString -> IO a) -> IO a Source #
Reads contents of a specified file as a lazy ByteString
(with streaming)
and provides it to the specified callback
Throws an error if specified file cannot be read
Arguments:
path :: Text
: path to filefun :: (Data.ByteString.Lazy.ByteString -> IO a)
: callback to process the file data
Return value: Result of the callback invocation
ioWithFileText :: Text -> (Text -> IO a) -> IO a Source #
Reads contents of a specified file as a lazy Text
(with streaming)
and provides it to the specified callback
File contents are decoded as UTF-8
Throws an error if specified file cannot be read
Arguments:
path :: Text
: path to filefun :: (Data.Text.Lazy.Text -> IO a)
: callback to process the file data
Return value: Result of the callback invocation