@@ -40,9 +40,6 @@ module Streamly.Tutorial
4040 -- * Flavors of Streams
4141 -- $flavors
4242
43− -- * Writing Concurrent Programs
44− -- $programs
45−
4643 -- * Imports and Supporting Code
4744 -- $imports
4845
@@ -129,6 +126,9 @@ module Streamly.Tutorial
129126 -- * Reactive Programming
130127 -- $reactive
131128
129+ -- * Writing Concurrent Programs
130+ -- $programs
131+
132132 -- * Performance
133133 -- $performance
134134
@@ -238,14 +238,19 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
238238--
239239-- When writing concurrent programs it is advised to not use the concurrent
240240-- style stream combinators blindly at the top level. That might create too
241−-- much concurrency where it is not even required and therefore degrade
242−-- performance. Please be aware of what all APIs that you have used may become
243−-- concurrent when you use a concurrency combinator. For example if you have a
244−-- 'repeatM' somewhere in your program and you use 'parallely' on top, the
245−-- 'repeatM' becomes fully parallel, resulting into an infinite parallel
246−-- execution . Instead start with a default serial program and add concurrent
247−-- combinators where necessary, and use the 'serially' combinator to suppress
248−-- unnecessary concurrency.
241+-- much concurrency where it is not even required, and can even degrade
242+-- performance in some cases. In some cases it can also lead to surprising
243+-- behavior because of some code that is supposed to be serial becoming
244+-- concurrent. Please be aware that all concurrency capable APIs that you may
245+-- have used under the scope of a concurrent stream combinator will become
246+-- concurrent. For example if you have a 'repeatM' somewhere in your program
247+-- and you use 'parallely' on top, the 'repeatM' becomes fully parallel,
248+-- resulting into an infinite parallel execution . Instead, use the
249+-- /Keep It Serial and Stupid/ principle, start with the default serial
250+-- composition and enable concurrent combinators only when and where necessary.
251+-- When you use a concurrent combinator you can use an explicit 'serially'
252+-- combinator to suppress any unnecessary concurrency under the scope of that
253+-- combinator.
249254
250255-- $monadtransformers
251256--