Safe Haskell | None |
---|---|
Language | Haskell2010 |
VtUtils.IO
Description
IO utilities
Synopsis
- data IOWithFileException = IOWithFileException {}
- ioWithFileBytes :: Text -> (ByteString -> IO a) -> IO a
- ioWithFileText :: Text -> (Text -> IO a) -> IO a
Documentation
data IOWithFileException Source #
Exception for ioWithFileBytes
and ioWithFileText
functions
Constructors
IOWithFileException | |
Fields
|
Instances
Show IOWithFileException Source # | |
Defined in VtUtils.IO Methods showsPrec :: Int -> IOWithFileException -> ShowS # show :: IOWithFileException -> String # showList :: [IOWithFileException] -> ShowS # | |
Exception IOWithFileException Source # | |
Defined in VtUtils.IO Methods toException :: IOWithFileException -> SomeException # fromException :: SomeException -> Maybe IOWithFileException # |
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 IOWithFileBytesException
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 IOWithFileBytesException
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