Contents
- Conduit <A, B>
- Sink
- Source
- Post (A value)
- Complete ()
- Fail (Error Error)
- Reduce <S> (S state, ReducerAsync<B, S> reducer)
- Reduce <M, S> (S state, ReducerAsync<B, S> reducer)
- Map <C> (Func<B, C> f)
- Select <C> (Func<B, C> f)
- Transform <C> (Transducer<B, C> transducer)
- Comap <X> (Func<X, A> f)
- CoTransform <X> (Transducer<X, A> transducer)
- ToConsumerT <M> ()
- ToConsumer <RT> ()
- ToProducerT <M> ()
- ToProducer <RT> ()
- Where (Func<B, bool> f)
- Filter (Func<B, bool> f)
- Skip (int amount)
- Take (int amount)
- FoldWhile <S> (Func<S, B, S> Fold, Func<S, B, bool> Pred, S Init)
- FoldUntil <S> (Func<S, B, S> Fold, Func<S, B, bool> Pred, S Init)
- FoldWhile <S> ( Schedule Time, Func<S, B, S> Fold, Func<S, B, bool> Pred, S Init)
- FoldUntil <S> ( Schedule Time, Func<S, B, S> Fold, Func<S, B, bool> Pred, S Init)
- ConduitExtensions
- Conduit
- Conduit <A>
Sub modules
| Internal |
Represents a channel with an internal queue. A channel has:
- A sink: an input transducer that manipulates values before being placed into the internal queue.
- A buffer:
System.Threading.Channels.Channel. - A source: an output transducer that manipulates values after being taken from the internal queue.
Both sides of the conduit can be manipulated:
The sink is a co-functor and can be mapped using Comap or CoTransform, these transform values before they get
to the conduit's buffer.
The source is a functor, so you can Map or Transform in the usual way to map values on their way out of the
buffer.
Control of the internal buffer is provided by passing a Buffer value to Conduit.make. This allows you to set
various parameters for the internal queue, such as the maximum number of items to hold in the queue, and what
strategy to use when the queue is full. The default is Buffer.Unbounded.
ToProducer and ToConsumer enable the Conduit components to be used in composed pipe effects.
Parameters
| type | A | Input value type |
| type | B | Output value type |
Properties
Methods
method IO<Unit> Post (A value) Source #
Post a value to the Sink
Raises Errors.SinkFull if the Sink is full or closed.
Parameters
| param | value | Value to post |
| returns | IO computation that represents the posting | |
method IO<S> Reduce <S> (S state, ReducerAsync<B, S> reducer) Source #
Iterate the stream, flowing values downstream to the reducer, which aggregates a result value.
Parameters
| type | S | State type |
| param | state | State to reduce |
| param | reducer | Reducer |
| returns | Reduced state | |
method K<M, S> Reduce <M, S> (S state, ReducerAsync<B, S> reducer) Source #
Iterate the stream, flowing values downstream to the reducer, which aggregates a result value.
Parameters
| type | S | State type |
| param | state | State to reduce |
| param | reducer | Reducer |
| returns | Reduced state | |
method Conduit<A, C> Transform <C> (Transducer<B, C> transducer) Source #
Transform with a transducer
Parameters
| param | transducer | Transducer to use to transform |
| returns | Transformed source | |
method Conduit<X, B> CoTransform <X> (Transducer<X, A> transducer) Source #
Co-transform with a transducer
Parameters
| param | transducer | Transducer to use to transform |
| returns | Transformed source | |
method ConsumerT<A, M, Unit> ToConsumerT <M> () Source #
Convert the Sink to a ConsumerT pipe component
Parameters
| type | M | Monad to lift (must support |
| returns |
| |
method Consumer<RT, A, Unit> ToConsumer <RT> () Source #
Convert the Sink to a Consumer pipe component
Parameters
| returns |
| |
method ProducerT<B, M, Unit> ToProducerT <M> () Source #
Convert Source to a ProducerT pipe component
Parameters
| type | M | Monad to lift (must support |
| returns |
| |
method Producer<RT, B, Unit> ToProducer <RT> () Source #
Convert Source to a Producer pipe component
Parameters
| returns |
| |
method Conduit<A, B> Where (Func<B, bool> f) Source #
Filter values. Yielding downstream when true
Parameters
| param | f | Filter function |
| returns | SourceT where the only values yield are those that pass the predicate | |
method Conduit<A, B> Filter (Func<B, bool> f) Source #
Filter values. Yielding downstream when true
Parameters
| param | f | Filter function |
| returns | SourceT where the only values yield are those that pass the predicate | |
method Conduit<A, B> Skip (int amount) Source #
Skip items in the source
Parameters
| param | amount | Amount to skip |
| returns | Transformed source | |
method Conduit<A, B> Take (int amount) Source #
Limit the number of items processed
Parameters
| param | amount | Number to take |
| returns | Transformed source | |
method Conduit<A, S> FoldWhile <S> (Func<S, B, S> Fold, Func<S, B, bool> Pred, S Init) Source #
Fold the values flowing through. Values are yielded downstream when either the predicate returns
false, or the source completes.
Parameters
| type | S | State type |
| param | Fold | Binary operator |
| param | Pred | Predicate |
| param | Init | Initial state |
| returns | Stream of aggregate states | |
method Conduit<A, S> FoldUntil <S> (Func<S, B, S> Fold, Func<S, B, bool> Pred, S Init) Source #
Fold the values flowing through. Values are yielded downstream when either the predicate returns
true, or the source completes.
Parameters
| type | S | State type |
| param | Fold | Binary operator |
| param | Pred | Predicate |
| param | Init | Initial state |
| returns | Stream of aggregate states | |
method Conduit<A, S> FoldWhile <S> ( Schedule Time, Func<S, B, S> Fold, Func<S, B, bool> Pred, S Init) Source #
Fold the values flowing through. Values are yielded downstream when either the schedule expires, the
predicate returns false, or the source completes.
Parameters
| type | S | State type |
| param | Time | Schedule to control the rate of processing |
| param | Fold | Binary operator |
| param | Pred | Predicate |
| param | Init | Initial state |
| returns | Stream of aggregate states | |
method Conduit<A, S> FoldUntil <S> ( Schedule Time, Func<S, B, S> Fold, Func<S, B, bool> Pred, S Init) Source #
Fold the values flowing through. Values are yielded downstream when either the schedule expires, the
predicate returns true, or the source completes.
Parameters
| type | S | |
| param | Time | Schedule to control the rate of processing |
| param | Fold | Binary operator |
| param | Pred | Predicate |
| param | Init | Initial state |
| returns | Stream of aggregate states | |
class ConduitExtensions Source #