plutus-pab-1.2.0.0
Safe Haskell None
Language Haskell2010

Control.Concurrent.STM.Extras.Stream

Synopsis

Documentation

data STMStream a Source #

An STM stream of a s (poor man's pull-based FRP)

readOne :: STMStream a -> IO (a, Maybe ( STMStream a)) Source #

Read the first event from the stream.

readN :: Natural -> STMStream a -> IO [a] Source #

Read a number of events from the stream. Blocks until all events have been received.

foldM Source #

Arguments

:: STMStream a

The stream

-> (a -> IO ())

Event handler

-> IO ()

Handler for the end of the stream

-> IO ()

Consume a stream. Blocks until the stream has terminated.

unfold :: forall a. Eq a => STM a -> STMStream a Source #

Produce an infinite stream of values from an STM (i.e. watch it for updates). Uses the Eq instance to not output the same value twice in a row.

unfoldOn :: forall a b. Eq b => (a -> b) -> STM a -> STMStream a Source #

Produce an infinite stream of values from an STM (i.e. watch it for updates). Uses the Eq instance of b to not output the same value twice in a row.

singleton :: STM a -> STMStream a Source #

Build a stream containing only one element.

dedupe :: forall a. Eq a => STMStream a -> STMStream a Source #

Remove consecutive duplicates from a stream.