Skip to content

Commit f8afdaf

Browse files
Fix docspec for Data.Fold
1 parent 38e5274 commit f8afdaf

File tree

3 files changed

+9
-27
lines changed

3 files changed

+9
-27
lines changed

core/src/Streamly/Internal/Data/Fold.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,7 @@ demuxDefault = demuxDefaultWith id
15341534
--
15351535
-- >>> :{
15361536
-- 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
15381538
-- :}
15391539
-- fromList [("ONE",[1.0,1.1]),("TWO",[2.0,2.2])]
15401540
--

src/Streamly/Internal/Data/Fold/Async.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import Streamly.Internal.Data.Fold.Type
2828

2929
-- $setup
3030
-- >>> :m
31+
-- >>> :set -XFlexibleContexts
3132
-- >>> import qualified Streamly.Prelude as Stream
3233
-- >>> import qualified Streamly.Data.Fold as Fold
3334
-- >>> import qualified Streamly.Internal.Data.Fold.Async as Fold

test/README.md

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,12 @@ all the test suites before running `Prelude.Serial`.
9494

9595
## Writing doctests
9696

97-
* The test named `doctest` runs all the code snippets in a source module
98-
that are written using the `>>>` markup in haddock. See `doctest.hs`.
97+
* We use `cabal-docspec` to run all the code snippets in a source module
98+
that are written using the `>>>` markup in haddock.
9999
* Make sure you do not enclose your snippets in the `@ .. @` markup otherwise
100100
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.
104101
* 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.
106103

107104
An example setup section:
108105

@@ -113,8 +110,8 @@ An example setup section:
113110
-- >>> import Data.Function ((&))
114111
```
115112

116-
Some tests that may take long can be written as follows. Just assigning
117-
the code to a function makes it compile but not run.
113+
Some tests that may take long can be written as follows. Just defining
114+
the snippet as a function makes it compile but not run.
118115

119116
```
120117
>>> :{
@@ -128,27 +125,11 @@ main = do
128125

129126
## Running doctests
130127

131-
Run tests for all modules:
132-
133-
```
134-
$ cabal run doctests --flag doctests
135-
```
136-
137-
Use verbose mode to debug:
138-
139128
```
140-
$ cabal run doctests --flag doctests -- --verbose
129+
$ cabal build all
130+
$ cabal-docspec --timeout 60 --check-properties --property-variables xs
141131
```
142132

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-
152133
## Naming of test modules
153134

154135
Tests are organized by source modules. For example, for the source

0 commit comments

Comments
 (0)