úÎcmb     Common definitions*© 2015 Patryk Zadarnowski <pat@jantar.org>BSD3pat@jantar.org experimentalportableSafeFIN A Quiver effectO, represented by a stream processor with unspecified input and output types. A Quiver consumerE, represented by a stream processor with unspecified output types. A Quiver producerD, represented by a stream processor with unspecified input types.The main Quiver stream processor type P a' a b' b f r, representing a producerconsumer structure with bidirectional/, bounded• communication on both the upstream (consumer) and downstream (producer) channel. The six type parameters have the following intuitive meaning:a' is the type of a request€ values sent by the stream processor to its upstream partner in order to receive the next element of the input stream.am is the type of the actual information being consumed by this stream processor (i.e., its input stream.)b' is the type of the response values received from the downstream partner for each elemnet of the output stream produced by this stream processor.f' is the type of the stream processor's  base functorz; usually this is a monad used for stateful stream processing, exception handling and/or real-world interaction.r is the stream processor's  delivery type4, used for monadic stream processor definition.\Every stream processor is a functor over its delivery type. However, if the base functor f) meets the additional requirements of  or d, so will the stream processor itself. Note that, unlike most other stream processing libraries, f¡ is not required to be a monad in most applications, although only time will tell whether this generalisation has useful applications in the real world. Consume x k q represents a  consumer step, in which the request xE is sent upstream and the returned input value is supplied to the continuation processor k*, or, if the upstream partner has been depleted[ (i.e., delivered its ultimate result, hence reaching the end of processing), to the decoupled continuation q. Produce y k q represent a  producer step, in which the output value yL is sent downstream, and the returned acknowledgement is supplied to the continuation processor k), or, if the downstream partner has been  decoupled[ (i.e., delivered its ultimate result, hence reaching the end of processing), to the depleted continuation q.Enclose9 allows for selective application of the base functor f& the the remainder of the computation. Deliver rH completes processing of information, delivering its ultimate result r. consume x k q represents a  consumer step, in which the request xE is sent upstream and the returned input value is supplied to the continuation processor k*, or, if the upstream partner has been depleted[ (i.e., delivered its ultimate result, hence reaching the end of processing), to the decoupled continuation q.  produce y k q represent a  producer step, in which the output value yL is sent downstream, and the returned acknowledgement is supplied to the continuation processor k), or, if the downstream partner has been  decoupled[ (i.e., delivered its ultimate result, hence reaching the end of processing), to the depleted continuation q. enclose9 allows for selective application of the base functor f& the the remainder of the computation.  deliver rH completes processing of information, delivering its ultimate result r.  decouple p  decouples the stream processor p-, by replacing the first consumer step in pC with that step's decoupled contination, effectively converting pJ into a producer processor that no longer expects to receive any input.  deplete p depletes the stream processor p-, by replacing the first producer step in pB with that step's depleted contination, effectively converting pF into a consumer processor that will never produce any more output.    Core Quiver definitions*© 2015 Patryk Zadarnowski <pat@jantar.org>BSD3pat@jantar.org experimentalportableSafeFINfetch xI represents a singleton stream processor that sends the request value x< upstream and delivers the next input value received, or Nothing0 if the upstream processor has been depleted. fetch' x qI represents a singleton stream processor that sends the request value x” upstream and delivers the next input value received, or, if the upstream processor has been depleted, continues with the decoupled processor q.emit yP represents a singleton stream processor that produces a single output value yL and delivers the response received from the downstream processor, or Nothing0 if the downstream processor has been decoupled. emit' y qP represents a singleton stream processor that produces a single output value y¦ and delivers the response received from the downstream processor, or, if the downstream processor has been decoupled, continues with the depleted processor q. emit' y qP represents a singleton stream processor that produces a single output value yB, ignoring any response received from the downstream processor.liftP; lifts the value of a base functor into a stream processor.The >>->= represents a push-based composition of stream processor.  p1 >>-> p2> represents a stream processor that forwards the output of p1 to p2D, delivering the result of both processors. The new processor is driven by p2P, so, if the base functor represents a non-commutative monad, any effects of p2% will be observed before those of p1.The >->>= represents a pull-based composition of stream processor.  p1 >->> p2> represents a stream processor that forwards the output of p1 to p2D, delivering the result of both processors. The new processor is driven by p1P, so, if the base functor represents a non-commutative monad, any effects of p1% will be observed before those of p2.        quive_LeR45i4HWcFHhYpKWqVXzzControl.Quiver.InternalControl.QuiverEffectConsumerProducerPConsumeProduceEncloseDeliverconsumeproduceenclosedeliverdecoupledepletefetchfetch'emitemit'emit_liftP>>->>->>baseGHC.Base ApplicativeMonad$fMonadP$fApplicativeP $fFunctorP