@@ -24,7 +24,9 @@
2424-- Continuation passing style (CPS) stream implementation. The symbol 'K' below
2525-- denotes a function as well as a Kontinuation.
2626--
27+-- @
2728-- import qualified Streamly.Streams.StreamK as K
29+-- @
2830--
2931module Streamly.Streams.StreamK
3032 (
@@ -38,8 +40,6 @@ module Streamly.Streams.StreamK
3840 -- * Construction
3941 , mkStream
4042 , nil
41− , yield
42− , yieldM
4343 , cons
4444 , (.:)
4545
@@ -48,27 +48,33 @@ module Streamly.Streams.StreamK
4848 , yieldK
4949 , consK
5050
51− -- * Generation
51+ -- * Generation by Unfolding
5252 , unfoldr
5353 , unfoldrM
54+
55+ -- * Special Generation
56+ , yield
57+ , yieldM
5458 , repeat
5559 , fromFoldable
5660
57− -- * Elimination
61+ -- * Elimination by Folding
62+ -- ** General Folds
5863 , foldStream
5964 , foldr
6065 , foldrM
61− , foldx
6266 , foldl'
63− , foldxM
6467 , foldlM'
68+ , foldx
69+ , foldxM
6570
71+ -- ** Special Folds
6672 , runStream
6773 , mapM_
6874 , toList
6975 , last
7076
71− -- * Transformation
77+ -- * Mapping
7278 , map
7379 , mapM
7480
@@ -99,14 +105,16 @@ import Streamly.SVar
99105-- The basic stream type
100106------------------------------------------------------------------------------
101107
102−-- | The type 'Stream m a' represents a monadic stream of values of type 'a'
108+-- | The type @Stream m a@ represents a monadic stream of values of type 'a'
103109-- constructed using actions in monad 'm'. It uses stop, singleton and yield
104110-- continuations equivalent to the following direct style type:
105111--
112+-- @
106113-- data Stream m a = Stop | Singleton a | Yield a (Stream m a)
114+-- @
107115--
108−-- To facilitate parallel composition we maintain a local state in an SVar that
109−-- is shared across and is used for synchronization of the streams being
116+-- To facilitate parallel composition we maintain a local state in an 'SVar'
117+-- that is shared across and is used for synchronization of the streams being
110118-- composed.
111119--
112120-- The singleton case can be expressed in terms of stop and yield but we have