úΛ֖áM      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLNone*+IN -Map a stream to its church encoding; compare Data.List.foldr %Reflect a church-encoded stream; cp. GHC.Exts.build CInspect the first stage of a freely layered sequence. Compare  Pipes.next and the replica Streaming.Prelude.next. This is the uncons for the general  . Hunfold inspect = id Streaming.Prelude.unfoldr StreamingPrelude.next = id Build a StreamG by unfolding steps starting from a seed. See also the specialized  in the prelude. Ïunfold inspect = id -- modulo the quotient we work with unfold Pipes.next :: Monad m => Producer a m r -> Stream ((,) a) m r unfold (curry (:>) . Pipes.next) :: Monad m => Producer a m r -> Stream (Of a) m r BMap layers of one functor to another with a natural transformation SMap layers of one functor to another with a transformation involving the base monad=Interpolate a layer at each segment. This specializes to e.g. `intercalates :: (Monad m, Functor f) => Stream f m () -> Stream (Stream f m) m r -> Stream f m rSpecialized fold ;iterTM alg stream = destroy stream alg (join . lift) returnSpecialized fold 1iterT alg stream = destroy stream alg join return.This specializes to the more transparent case: Jconcats :: (Monad m, Functor f) => Stream (Stream f m) m r -> Stream f m r&Thus dissolving the segmentation into  Stream f m layers. 9concats stream = destroy stream join (join . lift) return[Split a succession of layers after some number, returning a streaming or effectful pair.>Break a stream into substreams each with n functorial layers. cMake it possible to 'run' the underlying transformed monad. A simple minded example might be:  ¼debugFibs = flip runStateT 1 $ distribute $ loop 1 where loop n = do S.yield n s <- lift get liftIO $ putStr "state is: " >> print s lift $ put (s + n :: Int) loop s*S.print $ S.take 4 $ S.drop 4 $ debugFibs state is: 1 state is: 2 state is: 3 state is: 55 state is: 88 state is: 1313 state is: 2121 MNOPQRS    MNOPQRSNone+-./IN3HA left-strict pair; the base functor for streams of individual elements.0Apply an action to all values flowing downstreamlet debug str = chain print str+S.product (debug (S.each [2..4])) >>= print23424PMake a stream of traversable containers into a stream of their separate elements+Streaming.print $ concat (each ["hi","ho"])'h''i''h''o'BReduce a stream, performing its actions but ignoring its elements.BIgnore the first n elements of a stream, but carry out the actions2Ignore elements of a stream until a test succeeds.,Stream the elements of a foldable container.S.print $ S.each [1..3]123 /Skip elements of a stream that fail a predicate!2Skip elements of a stream that fail a monadic test"Strict fold of a  of elements MControl.Foldl.purely fold :: Monad m => Fold a b -> Stream (Of a) m () -> m b#Strict fold of a , of elements that preserves the return value RControl.Foldl.purely fold' :: Monad m => Fold a b -> Stream (Of a) m r -> m (b, r)$9Strict, monadic fold of the elements of a 'Stream (Of a)' QControl.Foldl.impurely foldM :: Monad m => FoldM a b -> Stream (Of a) m () -> m b%9Strict, monadic fold of the elements of a 'Stream (Of a)' VControl.Foldl.impurely foldM' :: Monad m => FoldM a b -> Stream (Of a) m r -> m (b, r)&XA natural right fold for consuming a stream of elements. See also the more general  in the  Streaming( module and the still more general  ¬foldrT (\a p -> Pipes.yield a >> p) :: Monad m => Stream (Of a) m r -> Producer a m r foldrT (\a p -> Conduit.yield a >> p) :: Monad m => Stream (Of a) m r -> Conduit a m r'WA natural right fold for consuming a stream of elements. See also the more general  in the  Streaming' module and the still more general (forv replaces each element of a stream with an associated stream. Note that the associated stream may layer any functor. THIterate a pure function from a seed value, streaming the results foreverUKIterate a monadic function from a seed value, streaming the results forever))Standard map on the elements of a stream.*MFor each element of a stream, stream a foldable container of elements instead)D.print $ D.mapFoldable show $ D.yield 12'1''2'+DReplace each element of a stream with the result of a monadic action,:Reduce a stream to its return value with a monadic action.0mapM_ Prelude.print $ each [1..3] >> return True123True-ŠMap free layers of a functor to a corresponding stream of individual elements. This simplifies the use of folds marked with a ''' in Streaming.Prelude ¸maps' sum' :: (Monad m, Num a) => Stream (Stream (Of a) m) m r -> Stream (Of a) m r maps' (Pipes.fold' (+) (0::Int) id) :: Monad m => Stream (Producer Int m) m r -> Stream (Of Int) m r.rThe standard way of inspecting the first item in a stream of elements, if the stream is still 'running'. The Right< case contains a Haskell pair, where the more general inspectE would return a left-strict pair. There is no reason to prefer inspect since, if the RightW case is exposed, the first element in the pair will have been evaluated to whnf. žnext :: Monad m => Stream (Of a) m r -> m (Either r (a, Stream (Of a) m r)) inspect :: Monad m => Stream (Of a) m r -> m (Either r (Of a (Stream (Of a) m r)))Interoperate with pipes producers thus: ‚Pipes.unfoldr Stream.next :: Stream (Of a) m r -> Producer a m r Stream.unfoldr Pipes.next :: Producer a m r -> Stream (Of a) m r  Similarly:  ÎIOStreams.unfoldM (liftM (either (const Nothing) Just) . next) :: Stream (Of a) IO b -> IO (InputStream a) Conduit.unfoldM (liftM (either (const Nothing) Just) . next) :: Stream (Of a) m r -> Source a m rBut see //~Inspect the first item in a stream of elements, without a return value. Useful for unfolding into another streaming type. ˆIOStreams.unfoldM uncons :: Stream (Of a) IO b -> IO (InputStream a) Conduit.unfoldM uncons :: Stream (Of o) m r -> Conduit.Source m o0Fold a  of numbers into their product1Fold a 4 of numbers into their product with the return value I mapsFold product' :: Stream (Stream (Of Int)) m r -> Stream (Of Int) m r2KMake a stream of strings into a stream of parsed values, skipping bad casesVRepeat an element several times46Repeat an action several times, streaming the results.5=Strict left scan, streaming, e.g. successive partial results. ZControl.Foldl.purely scan :: Monad m => Fold a b -> Stream (Of a) m r -> Stream (Of b) m rFStreaming.print $ Foldl.purely Streaming.scan Foldl.list $ each [3..5][][3][3,4][3,4,5]6Strict, monadic left scan `Control.Foldl.impurely scanM :: Monad m => FoldM a m b -> Stream (Of a) m r -> Stream (Of b) m r7 Like the 8 but streaming. The result type is a stream of a's, but is not accumulatedj; the effects of the elements of the original stream are interleaved in the resulting stream. Compare: wsequence :: Monad m => [m a] -> m [a] sequence :: Monad m => Stream (Of (m a)) m r -> Stream (Of a) m r9Fold a  of numbers into their sum:Fold a 0 of numbers into their sum with the return value E mapsFold sum' :: Stream (Stream (Of Int)) m r -> Stream (Of Int) m r;?Stream elements until one fails the condition, return the rest.<AEnd stream after n elements; the original return value is lost. splitAtB preserves this information. Note the function is functor-general.=QEnd stream when an element fails a condition; the original return value is lost ; preserves this information.>.Convert a pure 'Stream (Of a) into a list of a?5Convert an effectful 'Stream (Of a)' into a list of aNote: ? is not an idiomatic use of pipes?, but I provide it for simple testing purposes. Idiomatic pipess style consumes the elements immediately as they are generated instead of loading all elements into memory.@Convert an effectful ' into a list alongside the return valueNote: @ is not an idiomatic use of  streaming?, but I provide it for simple testing purposes. Idiomatic  streaming style, like idiomatic pipesg style consumes the elements as they are generated instead of loading all elements into memory. F mapsFold toListM' :: Stream (Stream (Of a)) m r -> Stream (Of [a]) m ABuild a StreamT by unfolding steps starting from a seed. This is one natural way to consume a . The more general  B would require dealing with the left-strict pair we are using. —unfoldr Pipes.next :: Monad m => Producer a m r -> Stream (Of a) m r unfold (curry (:>) . Pipes.next) :: Monad m => Producer a m r -> Stream (Of a) m rBA singleton streamCZip two Streamss DZip two Streams's using the provided combining functionErepeatedly stream lines as W from stdinF2 values from X, ignoring failed parsesGRead W s from a Y using ZTerminates on end of inputJ.Evaluate all values flowing downstream to WHNFKWrite Ws to [ using \Unlike H, K. gracefully terminates on a broken output pipeLWrite Ws to [ using \QThis does not handle a broken output pipe, but has a polymorphic return value?]^_ !"#$%&'(TU)*+,-./012`3V456789:;<=>?@ABCDEFGHIJKL;  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKL;BAEFG34KL,IH)+- 7* !(<=5628J./;"#$%9:01>?@'&CD>]^_ !"#$%&'(TU)*+,-./012`3V456789:;<=>?@ABCDEFGHIJKLNoneIN (- ( -  a    !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdbefbghbijbekblmnopqrstrea_9WafD46GKxx85mJqqKH5Rc StreamingStreaming.InternalStreaming.Preludeunfoldr Data.ListsequencePipesProducermmorp_8dNpUU8QFPe77rrwKAb20bControl.Monad.MorphhoistMFunctortrans_3eG64VdP2vzGjP6wJiCp5XControl.Monad.Trans.Class MonadTransliftStreamStepDelayReturndestroy constructinspectunfoldmapsmapsM intercalatesiterTMiterTconcatssplitchunksOf distributeOf:>lazilystrictlybreakchainconcatdraindrop dropWhileeachfilterfilterMfoldfold'foldMfoldM'foldrTfoldrMformap mapFoldablemapMmapM_maps'nextunconsproductproduct'readrepeatM replicateMscanscanMshowsumsum'spantake takeWhiletoListtoListMtoListM'yieldzipzipWithstdinLnreadLn fromHandletoHandleprintseqstdoutLn stdoutLn'$fMonadIOStream$fMMonadStream$fMFunctorStream$fMonadTransStream$fApplicativeStream $fMonadStream$fFunctorStreamiterateiterateM replicatebaseGHC.BaseStringGHC.IO.Handle.FDstdinGHC.IO.Handle.TypesHandleGHC.IO.Handle.TexthGetLinestdout System.IOputStrLnenumFrom enumFromTo enumFromStepNrepeat