pipes-extra-0.0.1: Various basic utilities for Pipes.

Safe HaskellSafe-Infered

Control.Pipe.ChunkPipe

Description

This module contains utilities to create and combine pipes that accept chunked input and return unconsumed portions of their internal buffer.

The main interface is an alternative monad instance for Pipe, which passes leftover data along automatically.

Synopsis

Documentation

newtype ChunkPipe a b m r Source

Newtype wrapper for Pipe proving a monad instance that takes care of passing leftover data automatically.

An individual ChunkPipe is just a regular pipe, but returns unconsumed input in a pair alongside the actual return value.

Constructors

ChunkPipe 

Fields

unChunkPipe :: Pipe a b m (a, r)
 

Instances

(Monoid a, Monad m) => Monad (ChunkPipe a b m) 

nonchunked :: (Monoid a, Monad m) => Pipe a b m r -> ChunkPipe a b m rSource

Create a ChunkPipe out of a regular pipe that is able to consume all its input.