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

Safe HaskellNone

Data.SouSiT.Handle

Contents

Synopsis

Source

hSource :: MonadIO m => (Handle -> m a) -> Handle -> FeedSource m aSource

Source from a handle. The handle will not be closed and is read till hIsEOF.

hSource' :: (Handle -> IO a) -> IO Handle -> FeedSource IO aSource

Same as hSource, but opens the handle when transfer is called and closes it when transfer/feedToSink completes. Uses bracket to ensure safe release of the allocated resources.

hSourceRes :: (MonadIO m, MonadResource m) => (Handle -> m a) -> IO Handle -> FeedSource m aSource

Same as hSource, but opens the handle when transfer is called and closes it when transfer/feedToSink completes.

hSourceNoEOF :: MonadIO m => (Handle -> m a) -> Handle -> FeedSource m aSource

Same as hSource, but does not check for hIsEOF and therefore never terminates.

hSourceNoEOF' :: (Handle -> IO a) -> IO Handle -> FeedSource IO aSource

Same as hSource', but does not check for hIsEOF and therefore never terminates.

hSourceResNoEOF :: (MonadIO m, MonadResource m) => (Handle -> m a) -> IO Handle -> FeedSource m aSource

Same as hSourceRes', but does not check for hIsEOF and therefore never terminates.

Sink

hSink :: MonadIO m => (Handle -> a -> m ()) -> Handle -> Sink a m ()Source

Sink backed by a handle. The data will be written by the provided function. The sink will never change to the SinkDone state (if the device is full then the operation will simply fail). The handle is not closed and exceptions are not catched.

hSinkRes :: (MonadIO m, MonadResource m) => (Handle -> a -> m ()) -> IO Handle -> Sink a m ()Source

Same as hSink, but does opens the handle when the first item is written. The handle will be closed when the sink is closed.