sousit-0.4: Source/Sink/Transform: An alternative to lazy IO and iteratees.

Safe HaskellSafe-Inferred

Data.SouSiT.Source

Contents

Synopsis

Documentation

class Source src whereSource

Something that produces data to be processed by a sink

Methods

transfer :: Monad m => src m a -> Sink a m r -> m rSource

data SimpleSource m a Source

A basic instance of Source

Constructors

SimpleSource (forall r. Sink a m r -> m r) 

Instances

data FeedSource m a Source

A basic instance of FeedSource (and Source)

Constructors

FeedSource 

Fields

feedToSink :: forall r. Sink a m r -> m (Sink a m r)
 

Instances

($$) :: (Source src, Monad m) => src m a -> Sink a m r -> m rSource

Transfer the data from the source into the sink

utility functions

concatSources :: (Source src2, Monad m) => FeedSource m a -> src2 m a -> SimpleSource m aSource

Concatenates two sources.

concatSources' :: Monad m => FeedSource m a -> FeedSource m a -> FeedSource m aSource

Concatenates two sources yielding a FeedSource.

(=+=) :: Monad m => FeedSource m a -> FeedSource m a -> FeedSource m aSource

Concatenates two sources.

(=+|=) :: (Source src2, Monad m) => FeedSource m a -> src2 m a -> SimpleSource m aSource

Concatenates two sources.

source construction

actionSource :: Monad m => m (Maybe i) -> FeedSource m iSource

Source that executes a monadic action to get its inputs. Terminates when the sink terminates or the action returns Nothing.

bracketActionSource :: IO a -> (a -> IO ()) -> (a -> IO (Maybe i)) -> FeedSource IO iSource

Source that first opens a resource, then transfers itself to the sink and the closes the resource again (in a bracket).