Contents
- ConduitT <M, A, B>
- Post (A value)
- PostM (K<M, A> ma)
- Complete ()
- Fail (Error Error)
- Reduce <S> (S state, ReducerM<M, B, S> reducer)
- Map <C> (Func<B, C> f)
- Select <C> (Func<B, C> f)
- Comap <X> (Func<X, A> f)
- Sink
- Source
- ToConsumerT ()
- ToProducerT ()
- Transform <C> (TransducerM<M, B, C> transducer)
- CoTransform <X> (TransducerM<M, X, A> transducer)
- 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)
- ConduitTExtensions
- As <M, A, B> (this K<ConduitT<M, A>, B> ma)
- ToConsumer <RT, A, B> (this ConduitT<Eff<RT>, A, B> conduit)
- ToProducer <RT, A, B> (this ConduitT<Eff<RT>, A, B> conduit)
- ConduitT
- ConduitT <M, A>
Sub modules
| Internal |
class ConduitT <M, A, B> Source #
Represents a channel with an internal queue. A channel has:
- A
Sink: an input DSL that manipulates values before being placed into the internal queue. - An internal queue: usually a
System.Threading.Channels.Channel. - A
Source: an output DSL that manipulates values after being taken from the internal queue.
Both sides of the ConduitT can be manipulated:
The Sink is a Cofunctor and can be mapped using Comap, this transforms values before they get to the
channel.
The Source is a monad-transformer, so you can Map, Bind, Apply, in the usual way to map values on their way
out. They manipulate values as they leave the channel through the Source.
Control of the internal queue is provided by passing a Buffer value to ConduitT.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 ConduitT components to be used in composed pipe effects.
Parameters
| type | A | Input value type |
| type | B | Output value type |
| param | Sink | Sink |
| param | Source | Source |
Properties
Methods
method K<M, 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 K<M, Unit> PostM (K<M, A> ma) Source #
Post a value to the Sink
Raises Errors.SinkFull if the sink is full or closed.
Parameters
| param | ma | Operation to post |
| returns | IO computation that represents the posting | |
method K<M, S> Reduce <S> (S state, ReducerM<M, B, S> reducer) Source #
Iterate the stream, flowing values downstream to the reducer, which aggregates a result value. This is returned lifted.
Note, this is recursive, so M needs to be able to support recursion without
blowing the stack. If you have the IO monad in your stack, then this will automatically
be the case.
Parameters
| type | S | State type |
| param | state | Initial state |
| param | reducer | Reducer |
| returns | Lifted aggregate state | |
method ConsumerT<A, M, Unit> ToConsumerT () Source #
Convert the conduit's Sink to a ConsumerT pipe component
Parameters
| returns |
| |
method ProducerT<B, M, Unit> ToProducerT () Source #
Convert the conduit's Source to a ProducerT pipe component
Parameters
| returns |
| |
method ConduitT<M, A, C> Transform <C> (TransducerM<M, B, C> transducer) Source #
Transform with a transducer
Parameters
| param | transducer | Transducer to use to transform |
| returns | Transformed source | |
method ConduitT<M, X, B> CoTransform <X> (TransducerM<M, X, A> transducer) Source #
Co-transform with a transducer
Parameters
| param | transducer | Transducer to use to transform |
| returns | Transformed source | |
method ConduitT<M, 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 ConduitT<M, 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 ConduitT<M, A, B> Skip (int amount) Source #
Skip items in the source
Parameters
| param | amount | Number to skip |
| returns | Transformed source | |
method ConduitT<M, A, B> Take (int amount) Source #
Limit the number of items processed
Parameters
| param | amount | Number to take |
| returns | Transformed source | |
method ConduitT<M, 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 ConduitT<M, 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 ConduitT<M, 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 ConduitT<M, 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 ConduitTExtensions Source #
Methods
method ConduitT<M, A, B> As <M, A, B> (this K<ConduitT<M, A>, B> ma) Source #
method Consumer<RT, A, Unit> ToConsumer <RT, A, B> (this ConduitT<Eff<RT>, A, B> conduit) Source #
Convert the conduit's Sink to a Consumer pipe component
Parameters
| returns |
| |
method Producer<RT, B, Unit> ToProducer <RT, A, B> (this ConduitT<Eff<RT>, A, B> conduit) Source #
Convert the conduit's Source to a Producer pipe component
Parameters
| returns |
| |
Methods
method ConduitT<M, A, A> make <M, A> () Source #
Create a new unbounded Conduit
Parameters
| type | A | Value type |
| param | label | Label for debugging purposes |
| returns | Constructed Conduit with an | |
method ConduitT<M, A, A> make <M, A> (Buffer<A> buffer) Source #
Create a new Conduit with the buffer settings provided
Parameters
| type | A | Value type |
| param | buffer | Buffer settings |
| param | label | Label for debugging purposes |
| returns | Constructed Conduit with an | |
method K<M, ConduitT<M, A, A>> makeM <M, A> () Source #
Create a new unbounded Conduit
Parameters
| type | A | Value type |
| param | label | Label for debugging purposes |
| returns | Constructed Conduit with an | |
method K<M, ConduitT<M, A, A>> makeM <M, A> (Buffer<A> buffer) Source #
Create a new Conduit with the buffer settings provided
Parameters
| type | A | Value type |
| param | buffer | Buffer settings |
| param | label | Label for debugging purposes |
| returns | Constructed Conduit with an | |