@@ -109,14 +109,11 @@ module Streamly.Tutorial
109 -- * Reactive Programming
109 -- * Reactive Programming
110 -- $reactive
110 -- $reactive
112− -- * State Machine Model
115 -- * Performance
112 -- * Performance
116 -- $performance
113 -- $performance
118− -- * Interworking with Streaming Libraries
115+ -- * Interoperation with Streaming Libraries
119− -- $interwork
116+ -- $interop
121 -- * Comparison with Existing Packages
118 -- * Comparison with Existing Packages
122 -- $comparison
119 -- $comparison
@@ -872,8 +869,74 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
872-- concurrency in streamly. You can also find a SDL based reactive programming
869-- concurrency in streamly. You can also find a SDL based reactive programming
873-- example adapted from Yampa in "Streamly.Examples.CirclingSquare".
870-- example adapted from Yampa in "Streamly.Examples.CirclingSquare".
875−-- $statemachine
872+-- $performance
876−-- State machine stuff
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
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.
891+-- import Streamly.Prelude
892+-- import System.IO (stdin)
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
899+-- Interop with @pipes@:
902+-- import qualified Pipes as P
903+-- import qualified Pipes.Prelude as P
906+-- -- streamly to pipe
907+-- P.runEffect $ P.for (P.unfoldr unconsE stdinLn) (lift . putStrLn)
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
915+-- Interop with @streaming@:
918+-- import qualified Streaming as S
919+-- import qualified Streaming.Prelude as S
922+-- -- streamly to streaming
923+-- S.stdoutLn $ S.unfoldr unconsE stdinLn
925+-- -- streaming to streamly
926+-- runStreamT $ unfoldrM S.uncons S.stdinLn >>= lift . putStrLn
930+-- Interop with @conduit@:
933+-- import qualified Data.Conduit as C
934+-- import qualified Data.Conduit.List as C
935+-- import qualified Data.Conduit.Combinators as C
937+-- -- streamly to conduit
938+-- main = (C.unfoldM 'uncons' stdinLn) C.$$ C.print
878-- $comparison
941-- $comparison