@@ -109,14 +109,11 @@ module Streamly.Tutorial
109109 -- * Reactive Programming
110110 -- $reactive
111111
112− -- * State Machine Model
113− -- $statemachine
114−
115112 -- * Performance
116113 -- $performance
117114
118− -- * Interworking with Streaming Libraries
119− -- $interwork
115+ -- * Interoperation with Streaming Libraries
116+ -- $interop
120117
121118 -- * Comparison with Existing Packages
122119 -- $comparison
@@ -872,8 +869,74 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
872869-- concurrency in streamly. You can also find a SDL based reactive programming
873870-- example adapted from Yampa in "Streamly.Examples.CirclingSquare".
874871
875−-- $statemachine
876−-- State machine stuff
872+-- $performance
873+--
874+-- Streamly is highly optimized for performance, it is designed for serious
875+-- high performing, concurrent and scalable applications. We have created the
876+-- <https://hackage.haskell.org/package/streaming-benchmarks streaming-benchmarks>
877+-- package which is specifically and carefully designed to measure the
878+-- performance of Haskell streaming libraries fairly and squarely in the right
879+-- way. Streamly performs at par or even better than most streaming libraries
880+-- for common operations even though it needs to deal with the concurrency
881+-- capability.
882+
883+-- $interop
884+--
885+-- We can use @unfoldr@ and @uncons@ to convert one streaming type to another.
886+-- We will assume the following common code to be available in the examples
887+-- demonstrated below.
888+--
889+-- @
890+-- import Streamly
891+-- import Streamly.Prelude
892+-- import System.IO (stdin)
893+--
894+-- -- Adapt uncons to return an Either instead of Maybe
895+-- unconsE s = 'uncons' s >>= maybe (return $ Left ()) (return . Right)
896+-- stdinLn = 'serially' $ 'fromHandle' stdin
897+-- @
898+--
899+-- Interop with @pipes@:
900+--
901+-- @
902+-- import qualified Pipes as P
903+-- import qualified Pipes.Prelude as P
904+--
905+-- main = do
906+-- -- streamly to pipe
907+-- P.runEffect $ P.for (P.unfoldr unconsE stdinLn) (lift . putStrLn)
908+--
909+-- -- pipe to streamly
910+-- -- Adapt P.next to return a Maybe instead of Either
911+-- let nextM p = P.next p >>= either (\\_ -> return Nothing) (return . Just)
912+-- runStreamT $ unfoldrM nextM P.stdinLn >>= lift . putStrLn
913+-- @
914+--
915+-- Interop with @streaming@:
916+--
917+-- @
918+-- import qualified Streaming as S
919+-- import qualified Streaming.Prelude as S
920+--
921+-- main = do
922+-- -- streamly to streaming
923+-- S.stdoutLn $ S.unfoldr unconsE stdinLn
924+--
925+-- -- streaming to streamly
926+-- runStreamT $ unfoldrM S.uncons S.stdinLn >>= lift . putStrLn
927+--
928+-- @
929+--
930+-- Interop with @conduit@:
931+--
932+-- @
933+-- import qualified Data.Conduit as C
934+-- import qualified Data.Conduit.List as C
935+-- import qualified Data.Conduit.Combinators as C
936+--
937+-- -- streamly to conduit
938+-- main = (C.unfoldM 'uncons' stdinLn) C.$$ C.print
939+-- @
877940
878941-- $comparison
879942--