plutus-pab-1.2.0.0
Safe HaskellNone
LanguageHaskell2010

Control.Concurrent.STM.Extras.Stream

Synopsis

Documentation

data STMStream a Source #

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

Instances

Instances details
Monad STMStream Source # 
Instance details

Defined in Control.Concurrent.STM.Extras.Stream

Methods

(>>=) :: STMStream a -> (a -> STMStream b) -> STMStream b Source #

(>>) :: STMStream a -> STMStream b -> STMStream b Source #

return :: a -> STMStream a Source #

Functor STMStream Source # 
Instance details

Defined in Control.Concurrent.STM.Extras.Stream

Methods

fmap :: (a -> b) -> STMStream a -> STMStream b Source #

(<$) :: a -> STMStream b -> STMStream a Source #

Applicative STMStream Source # 
Instance details

Defined in Control.Concurrent.STM.Extras.Stream

Methods

pure :: a -> STMStream a Source #

(<*>) :: STMStream (a -> b) -> STMStream a -> STMStream b Source #

liftA2 :: (a -> b -> c) -> STMStream a -> STMStream b -> STMStream c Source #

(*>) :: STMStream a -> STMStream b -> STMStream b Source #

(<*) :: STMStream a -> STMStream b -> STMStream a Source #

Eq a => Semigroup (STMStream a) Source # 
Instance details

Defined in Control.Concurrent.STM.Extras.Stream

Eq a => Monoid (STMStream a) Source # 
Instance details

Defined in Control.Concurrent.STM.Extras.Stream

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.