Data.Iteratee.IO.Fd

iteratee-0.8.8.1: Iteratee-based I/O

Data.Iteratee.IO.Fd

Contents

- File enumerators
  - FileDescriptor based enumerators for monadic iteratees
- Iteratee drivers

Description

Random and Binary IO with generic Iteratees, using File Descriptors for IO. when available, these are the preferred functions for performing IO as they run in constant space and function properly with sockets, pipes, etc.

Synopsis

- enumFd :: forall s el m a. (NullPoint s, ReadableChunk s el, MonadCatchIO m) => Int -> Fd -> Enumerator s m a
- enumFdCatch :: forall e s el m a. (IException e, NullPoint s, ReadableChunk s el, MonadCatchIO m) => Int -> Fd -> (e -> m (Maybe EnumException)) -> Enumerator s m a
- enumFdRandom :: forall s el m a. (NullPoint s, ReadableChunk s el, MonadCatchIO m) => Int -> Fd -> Enumerator s m a
- enumFile :: (NullPoint s, MonadCatchIO m, ReadableChunk s el) => Int -> FilePath -> Enumerator s m a
- enumFileRandom :: (NullPoint s, MonadCatchIO m, ReadableChunk s el) => Int -> FilePath -> Enumerator s m a
- fileDriverFd :: (NullPoint s, MonadCatchIO m, ReadableChunk s el) => Int -> Iteratee s m a -> FilePath -> m a
- fileDriverRandomFd :: (NullPoint s, MonadCatchIO m, ReadableChunk s el) => Int -> Iteratee s m a -> FilePath -> m a

# File enumerators

## FileDescriptor based enumerators for monadic iteratees

enumFd :: forall s el m a. (NullPoint s, ReadableChunk s el, MonadCatchIO m) => Int -> Fd -> Enumerator s m a

The enumerator of a POSIX File Descriptor. This version enumerates over the entire contents of a file, in order, unless stopped by the iteratee. In particular, seeking is not supported.

enumFdCatch :: forall e s el m a. (IException e, NullPoint s, ReadableChunk s el, MonadCatchIO m) => Int -> Fd -> (e -> m (Maybe EnumException)) -> Enumerator s m a

A variant of enumFd that catches exceptions raised by the `Iteratee`.

enumFdRandom :: forall s el m a. (NullPoint s, ReadableChunk s el, MonadCatchIO m) => Int -> Fd -> Enumerator s m a

The enumerator of a POSIX File Descriptor: a variation of `enumFd` that supports RandomIO (seek requests).

enumFile

Arguments

:: (NullPoint s, MonadCatchIO m, ReadableChunk s el) |
=> Int | Buffer size
-> FilePath |
-> Enumerator s m a |

enumFileRandom

Arguments

:: (NullPoint s, MonadCatchIO m, ReadableChunk s el) |
=> Int | Buffer size
-> FilePath |
-> Enumerator s m a |

# Iteratee drivers

fileDriverFd

Arguments

:: (NullPoint s, MonadCatchIO m, ReadableChunk s el) |
=> Int | Buffer size (number of elements)
-> Iteratee s m a |
-> FilePath |
-> m a |

Process a file using the given `Iteratee`.

fileDriverRandomFd :: (NullPoint s, MonadCatchIO m, ReadableChunk s el) => Int -> Iteratee s m a -> FilePath -> m a

A version of fileDriverFd that supports seeking.