Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Resampling buffers that collect the incoming data in some data structure and release all of it on output.
Synopsis
- collect :: Monad m => ResamplingBuffer m cl1 cl2 a [a]
- collectSequence :: Monad m => ResamplingBuffer m cl1 cl2 a (Seq a)
- pureBuffer :: Monad m => ([a] -> b) -> ResamplingBuffer m cl1 cl2 a b
- foldBuffer :: Monad m => (a -> b -> b) -> b -> ResamplingBuffer m cl1 cl2 a b
Documentation
collect :: Monad m => ResamplingBuffer m cl1 cl2 a [a] Source #
Collects all input in a list, with the newest element at the head,
which is returned and emptied upon get
.
collectSequence :: Monad m => ResamplingBuffer m cl1 cl2 a (Seq a) Source #
Reimplementation of collect
with sequences,
which gives a performance benefit if the sequence needs to be reversed or searched.
pureBuffer :: Monad m => ([a] -> b) -> ResamplingBuffer m cl1 cl2 a b Source #
pureBuffer
collects all input values lazily in a list
and processes it when output is required.
Semantically, pureBuffer f == collect >>-^ arr f
,
but pureBuffer
is slightly more efficient.
:: Monad m | |
=> (a -> b -> b) | The folding function |
-> b | The initial value |
-> ResamplingBuffer m cl1 cl2 a b |
A buffer collecting all incoming values with a folding function.
It is strict, i.e. the state value b
is calculated on every put
.