on master help sign in
Make StreamK, StreamD and Prelude haddock consistent
commitc7b46ad9509d76beb17f302e4b2f5c08d4cf3498 authorHarendra Kumar <harendra.kumar@gmail.com> dateSun 24 Jun 2018, 23:47 (8 years ago) parentc794c61
4 files changed+49−30
CONTRIBUTING.md+6 src/Streamly/Prelude.hs+13−13 src/Streamly/Streams/StreamD.hs+12−7 src/Streamly/Streams/StreamK.hs+18−10
CONTRIBUTING.md+6
@@ -9,6 +9,12 @@ we will appreciate if you provide as much detail as possible to reproduce or
99understand the problem, but nevertheless you are encouraged to open an issue
1010for any problem that you may encounter.
1111
12+## Developer documentation
13+
14+Build haddock with the `dev` flag to see the whole documentation and module
15+structure. For example,
16+`stack haddock --flag "streamly:dev" --no-haddock-deps`.
17+
1218## Pull Requests (PR)
1319
1420Please feel free to [send a pull
src/Streamly/Prelude.hs+13−13
@@ -46,15 +46,16 @@
4646module Streamly.Prelude
4747 (
4848 -- * Construction
49− -- | Primitives to construct or inspect a stream.
49+ -- | Primitives to construct a stream.
5050 K.nil
51− , K.yield
52− , K.yieldM
5351 , K.cons
5452 , (K..:)
5553 , consM
5654 , (|:)
5755
56+ -- * Deconstruction
57+ , uncons
58+
5859 -- * Generation by Unfolding
5960 , unfoldr
6061 , unfoldrM
@@ -62,6 +63,8 @@ module Streamly.Prelude
6263 -- * Special Generation
6364 -- | Generate a monadic stream from an input structure, a seed or a
6465 -- generation function.
66+ , K.yield
67+ , K.yieldM
6568 , replicateM
6669 , K.repeat
6770 , repeatM
@@ -72,9 +75,6 @@ module Streamly.Prelude
7275 , K.fromFoldable
7376 , fromFoldableM
7477
75− -- * Deconstruction
76− , uncons
77−
7878 -- * Elimination by Folding
7979 -- ** General Folds
8080 , foldr
@@ -105,6 +105,13 @@ module Streamly.Prelude
105105 , scanl'
106106 , scanx
107107
108+ -- * Mapping
109+ , Serial.map
110+ , mapM
111+ , mapMaybe
112+ , mapMaybeM
113+ , sequence
114+
108115 -- * Filtering
109116 , filter
110117 , take
@@ -115,13 +122,6 @@ module Streamly.Prelude
115122 -- * Reordering
116123 , reverse
117124
118− -- * Mapping
119− , Serial.map
120− , mapM
121− , mapMaybe
122− , mapMaybeM
123− , sequence
124−
125125 -- * Zipping
126126 , zipWith
127127 , zipWithM
src/Streamly/Streams/StreamD.hs+12−7
@@ -26,7 +26,9 @@
2626-- to INLINE and fuse direct style better, providing better performance than
2727-- CPS implementation.
2828--
29+-- @
2930-- import qualified Streamly.Streams.StreamD as D
31+-- @
3032--
3133module Streamly.Streams.StreamD
3234 (
@@ -35,23 +37,26 @@ module Streamly.Streams.StreamD
3537 , Stream (..)
3638
3739 -- * Construction
40+ -- | Direct style stream does not support construction by adding more
41+ -- elements to an existing stream.
3842 , nil
39− , yield
40− , yieldM
43+
44+ -- * Deconstruction
45+ , uncons
4146
4247 -- * Generation by Unfolding
4348 , unfoldr
4449 , unfoldrM
4550
4651 -- * Special Generation
52+ -- | Direct style stream does not support @fromFoldable@.
53+ , yield
54+ , yieldM
4755 , repeat
4856 , enumFromStepN
4957 , fromList
5058 , fromListM
5159
52− -- * Deconstruction
53− , uncons
54−
5560 -- * Elimination by Folding
5661 -- ** General Folds
5762 , foldr
@@ -86,8 +91,8 @@ import qualified Streamly.Streams.StreamK as K
8691------------------------------------------------------------------------------
8792
8893-- | A stream is a succession of 'Step's. A 'Yield' produces a single value and
89−-- the next state of the stream. Stop indicates there are no more values in the
90−-- stream.
94+-- the next state of the stream. 'Stop' indicates there are no more values in
95+-- the stream.
9196data Step s a = Yield a s | Stop
9297
9398instance Functor (Step s) where
src/Streamly/Streams/StreamK.hs+18−10
@@ -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