vt-utils-1.3.0.0: Vector and Text utilities

Safe HaskellNone
LanguageHaskell2010

VtUtils.IO

Description

IO utilities

Synopsis

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 IOWithFileBytesException if specified file cannot be read

Arguments:

  • path :: Text: path to file
  • fun :: (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 file
  • fun :: (Data.Text.Lazy.Text -> IO a): callback to process the file data

Return value: Result of the callback invocation