pipes-safe-2.0.2: Safety for the pipes ecosystem

Safe Haskell | Safe-Inferred

Pipes.Safe.Prelude

Contents

- Handle management
- String I/O

Description

Simple resource management functions

Synopsis

- withFile :: MonadSafe m => FilePath -> IOMode -> (Handle -> m r) -> m r
- readFile :: MonadSafe m => FilePath -> Producer' String m ()
- writeFile :: MonadSafe m => FilePath -> Consumer' String m r

# Handle management

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

Acquire a `Handle` within `MonadSafe`

# String I/O

Note that `String`s 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 rSource

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