Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
IOWithFileException | |
|
Instances
Show IOWithFileException Source # | |
Defined in VtUtils.IO showsPrec :: Int -> IOWithFileException -> ShowS # show :: IOWithFileException -> String # showList :: [IOWithFileException] -> ShowS # | |
Exception IOWithFileException Source # | |
Defined in VtUtils.IO |
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