Data.Iteratee.IO.Handle

iteratee-0.8.8.1: Iteratee-based I/O

Data.Iteratee.IO.Handle

Contents

- File enumerators
- Iteratee drivers

Description

Random and Binary IO with generic Iteratees. These functions use Handles for IO operations, and are provided for compatibility. When available, the File Descriptor based functions are preferred as these wastefully allocate memory rather than running in constant space.

Synopsis

- enumHandle :: forall s el m a. (NullPoint s, ReadableChunk s el, MonadCatchIO m) => Int -> Handle -> Enumerator s m a
- enumHandleCatch :: forall e s el m a. (IException e, NullPoint s, ReadableChunk s el, MonadCatchIO m) => Int -> Handle -> (e -> m (Maybe EnumException)) -> Enumerator s m a
- enumHandleRandom :: forall s el m a. (NullPoint s, ReadableChunk s el, MonadCatchIO m) => Int -> Handle -> 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
- fileDriverHandle :: (NullPoint s, MonadCatchIO m, ReadableChunk s el) => Int -> Iteratee s m a -> FilePath -> m a
- fileDriverRandomHandle :: (NullPoint s, MonadCatchIO m, ReadableChunk s el) => Int -> Iteratee s m a -> FilePath -> m a

# File enumerators

enumHandle

Arguments

:: forall s el m a . (NullPoint s, ReadableChunk s el, MonadCatchIO m) |
=> Int | Buffer size (number of elements per read)
-> Handle |
-> Enumerator s m a |

The (monadic) enumerator of a file Handle. This version enumerates over the entire contents of a file, in order, unless stopped by the iteratee. In particular, seeking is not supported. Data is read into a buffer of the specified size.

enumHandleCatch

Arguments

:: forall e s el m a . (IException e, NullPoint s, ReadableChunk s el, MonadCatchIO m) |
=> Int | Buffer size (number of elements per read)
-> Handle |
-> (e -> m (Maybe EnumException)) |
-> Enumerator s m a |

An enumerator of a file handle that catches exceptions raised by the Iteratee.

enumHandleRandom

Arguments

:: forall s el m a . (NullPoint s, ReadableChunk s el, MonadCatchIO m) |
=> Int | Buffer size (number of elements per read)
-> Handle |
-> Enumerator s m a |

The enumerator of a Handle: a variation of enumHandle that supports RandomIO (seek requests). Data is read into a buffer of the specified size.

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

fileDriverHandle

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`. This function wraps `enumHandle` as a convenience.

fileDriverRandomHandle

Arguments

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

A version of `fileDriverHandle` that supports seeking.