on master help sign in
Fix docspec for Data.Fold
f8afdafHarendra Kumar
core/src/Streamly/Internal/Data/Fold.hs+1−1
@@ -1534,7 +1534,7 @@ demuxDefault = demuxDefaultWith id
1534--
1534--
1535-- >>> :{
1535-- >>> :{
1536-- let input = Stream.fromList [("ONE",1),("ONE",1.1),("TWO",2), ("TWO",2.2)]
1536-- let input = Stream.fromList [("ONE",1),("ONE",1.1),("TWO",2), ("TWO",2.2)]
1537−-- in Stream.fold (Fold.classifyWith fst (Fold.map snd Fold.toList)) input
1537+-- in Stream.fold (Fold.classifyWith fst (Fold.lmap snd Fold.toList)) input
1538-- :}
1538-- :}
1539-- fromList [("ONE",[1.0,1.1]),("TWO",[2.0,2.2])]
1539-- fromList [("ONE",[1.0,1.1]),("TWO",[2.0,2.2])]
1540--
1540--
src/Streamly/Internal/Data/Fold/Async.hs+1
@@ -28,6 +28,7 @@ import Streamly.Internal.Data.Fold.Type
28
28
29-- $setup
29-- $setup
30-- >>> :m
30-- >>> :m
31+-- >>> :set -XFlexibleContexts
31-- >>> import qualified Streamly.Prelude as Stream
32-- >>> import qualified Streamly.Prelude as Stream
32-- >>> import qualified Streamly.Data.Fold as Fold
33-- >>> import qualified Streamly.Data.Fold as Fold
33-- >>> import qualified Streamly.Internal.Data.Fold.Async as Fold
34-- >>> import qualified Streamly.Internal.Data.Fold.Async as Fold
test/README.md+7−26
@@ -94,15 +94,12 @@ all the test suites before running `Prelude.Serial`.
94
94
95## Writing doctests
95## Writing doctests
96
96
97−* The test named `doctest` runs all the code snippets in a source module
97+* We use `cabal-docspec` to run all the code snippets in a source module
98− that are written using the `>>>` markup in haddock. See `doctest.hs`.
98+ that are written using the `>>>` markup in haddock.
99* Make sure you do not enclose your snippets in the `@ .. @` markup otherwise
99* Make sure you do not enclose your snippets in the `@ .. @` markup otherwise
100 they will show up verbatim in the docs and not as ghci styled snippets.
100 they will show up verbatim in the docs and not as ghci styled snippets.
101−* We use `--fast` mode of doctest, which means snippets are run as if you are
102− typing those examples from top to bottom in that order in GHCi. Previous
103− snippet's state is available to the next one.
104* A haddock section named `$setup` contains a snippet that is always run before
101* A haddock section named `$setup` contains a snippet that is always run before
105− any other. When `--fast` mode is not used it is run before every snippet.
102+ any other.
106
103
107An example setup section:
104An example setup section:
108
105
@@ -113,8 +110,8 @@ An example setup section:
113-- >>> import Data.Function ((&))
110-- >>> import Data.Function ((&))
114```
111```
115
112
116−Some tests that may take long can be written as follows. Just assigning
113+Some tests that may take long can be written as follows. Just defining
117−the code to a function makes it compile but not run.
114+the snippet as a function makes it compile but not run.
118
115
119```
116```
120>>> :{
117>>> :{
@@ -128,27 +125,11 @@ main = do
128
125
129## Running doctests
126## Running doctests
130
127
131−Run tests for all modules:
132−
133−```
134−$ cabal run doctests --flag doctests
135−```
136−
137−Use verbose mode to debug:
138−
139```
128```
140−$ cabal run doctests --flag doctests -- --verbose
129+$ cabal build all
130+$ cabal-docspec --timeout 60 --check-properties --property-variables xs
141```
131```
142
132
143−Run tests only for selected modules:
144−
145−```
146−$ cabal run doctests --flag doctests -- --modules Streamly.Prelude
147−```
148−
149−If it fails with a message that a particular modules is not loaded specify that
150−module as well on the command line.
151−
152## Naming of test modules
133## Naming of test modules
153
134
154Tests are organized by source modules. For example, for the source
135Tests are organized by source modules. For example, for the source