churros-0.1.6.0: Channel/Arrow based streaming computation library.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Churro.Transport.MVar.Latest

Description

MVar Transport Instance. New items overwrite the current queued item.

Useful in subscription-like contexts where you don't care about outdated values.

This is surprisingly useful since it doesn't block sources, but also doesn't accumulate items.

WARNING: Don't use if you want to ensure that all produced items are consumed!

Synopsis

Documentation

data Latest a Source #

Instances

Instances details
Transport Latest Source # 
Instance details

Defined in Control.Churro.Transport.MVar.Latest

Associated Types

data In Latest :: Type -> Type Source #

data Out Latest :: Type -> Type Source #

Methods

flex :: IO (In Latest a, Out Latest a) Source #

yank :: Out Latest a -> IO a Source #

yeet :: In Latest a -> a -> IO () Source #

data In Latest a Source # 
Instance details

Defined in Control.Churro.Transport.MVar.Latest

data In Latest a = ChanIn (MVar a)
data Out Latest a Source # 
Instance details

Defined in Control.Churro.Transport.MVar.Latest

data Out Latest a = ChanOut (MVar a)

runWaitLatest :: ChurroLatest a Void Void -> IO a Source #

Convenience function for running a Churro with a MVar backed Latest Transport.

runWaitListLatest :: ChurroLatest () Void o -> IO [o] Source #

Convenience function for running a Churro into a List with a MVar backed Latest Transport.