pipes-safe-2.3.3: Safety for the pipes ecosystem
Safe HaskellSafe
LanguageHaskell2010

Pipes.Safe.Prelude

Description

Simple resource management functions

Synopsis

Handle management

withFile :: MonadSafe m => FilePath -> IOMode -> (Handle -> m r) -> m r Source #

Acquire a Handle within MonadSafe

String I/O

Note that Strings are very inefficient, and I will release future separate packages with ByteString and Text operations. I only provide these to allow users to test simple I/O without requiring any additional library dependencies.

readFile :: MonadSafe m => FilePath -> Producer' String m () Source #

Read lines from a file, automatically opening and closing the file as necessary

writeFile :: MonadSafe m => FilePath -> Consumer' String m r Source #

Write lines to a file, automatically opening and closing the file as necessary