on master help sign in
Move the tutorial module to streamly-docs package
commit8ae6209219181330452e0cbe3b0f718c2f033166 authorHarendra Kumar <harendra@composewell.com> dateFri 11 Jun 2021, 02:25 (5 years ago) parent3622798
7 files changed+94−12
cabal.project+1 default.nix+4 docs/Setup.hs+6 src/Streamly/Tutorial.hs → docs/Tutorial.hs+2−2 docs/doctests.hs+28 docs/streamly-docs.cabal+46 streamly.cabal+7−10
cabal.project+1
@@ -1,3 +1,4 @@
11packages: streamly.cabal
22 , test/streamly-tests.cabal
33 , benchmark/streamly-benchmarks.cabal
4+ , docs/streamly-docs.cabal
default.nix+4
@@ -61,6 +61,9 @@ let haskellPackages =
6161 streamly-tests =
6262 mkPackage super "streamly-tests"
6363 ./test flags inShell;
64+ streamly-docs =
65+ mkPackage super "streamly-docs"
66+ ./docs flags inShell;
6467
6568 fusion-plugin =
6669 super.callHackageDirect
@@ -110,6 +113,7 @@ let haskellPackages =
110113 [ p.streamly
111114 p.streamly-benchmarks
112115 p.streamly-tests
116+ p.streamly-docs
113117 ];
114118 # some dependencies of hoogle fail to build with quickcheck-2.14
115119 # We should use hoogle as external tool instead of building it here
docs/Setup.hsnew file+6
@@ -0,0 +1,6 @@
1+module Main (main) where
2+
3+import Distribution.Extra.Doctest (defaultMainWithDoctests)
4+
5+main :: IO ()
6+main = defaultMainWithDoctests "streamly-docs-doctests"
src/Streamly/Tutorial.hs → docs/Tutorial.hsrenamed+2−2
@@ -1,6 +1,6 @@
11{-# OPTIONS_GHC -fno-warn-unused-imports #-}
22-- |
3−-- Module : Streamly.Tutorial
3+-- Module : Tutorial
44-- Copyright : (c) 2017 Composewell Technologies
55--
66-- License : BSD3
@@ -41,7 +41,7 @@
4141-- Once you finish this tutorial, see the last section for further reading
4242-- resources.
4343
44−module Streamly.Tutorial
44+module Tutorial
4545 (
4646 -- * Stream Types
4747 -- $streams
docs/doctests.hsnew file+28
@@ -0,0 +1,28 @@
1+module Main where
2+
3+import Build_doctests (flags, pkgs, module_sources)
4+import Data.Foldable (traverse_)
5+import System.Environment.Compat (getArgs, unsetEnv)
6+import Test.DocTest (doctest)
7+
8+import qualified Data.List as List
9+
10+main :: IO ()
11+main = do
12+ cliArgs <- getArgs
13+ let (cliArgs1, mods) =
14+ if (List.null (filter (== "--modules") cliArgs))
15+ then (cliArgs, module_sources)
16+ else (List.delete "--modules" cliArgs, [])
17+ let args =
18+ [ "-outputdir=./_doctests/"
19+ , "-fobject-code"
20+ , "--fast"
21+ ]
22+ ++ cliArgs1
23+ ++ flags
24+ ++ pkgs
25+ ++ mods
26+ traverse_ putStrLn args
27+ unsetEnv "GHC_ENVIRONMENT"
28+ doctest args
docs/streamly-docs.cabalnew file+46
@@ -0,0 +1,46 @@
1+cabal-version: 2.2
2+-- Reasons for having a separate package for docs:
3+-- * Leaner main package and better modularity
4+-- * This package can be forked out as an independent package
5+-- * We can have code examples in haddock with more dependencies
6+-- * Documentation can be released independent of the library
7+-- * We do not want too many doc modules in the main library
8+name: streamly-docs
9+version: 0.0.0
10+synopsis: Documentation for Streamly
11+description: Documentation for Streamly
12+build-type: Custom
13+custom-setup
14+ setup-depends:
15+ base >= 4 && <5,
16+ cabal-doctest >= 1 && <1.1,
17+ Cabal >= 2.2 && < 4
18+
19+-------------------------------------------------------------------------------
20+-- Library
21+-------------------------------------------------------------------------------
22+
23+library
24+ default-language: Haskell2010
25+ ghc-options: -Wall
26+ hs-source-dirs: .
27+ exposed-modules:
28+ Tutorial
29+
30+ build-depends:
31+ base >= 4.9 && < 5
32+ , transformers >= 0.4 && < 0.6
33+ , streamly
34+
35+test-suite streamly-docs-doctests
36+ type: exitcode-stdio-1.0
37+ default-language: Haskell2010
38+ ghc-options: -Wall
39+ hs-source-dirs: .
40+ main-is: doctests.hs
41+ autogen-modules: Build_doctests
42+ build-depends:
43+ base
44+ , base-compat >= 0.10.5 && < 0.12
45+ , doctest >= 0.15 && < 0.19
46+ , streamly-docs
streamly.cabal+7−10
@@ -102,11 +102,11 @@ extra-source-files:
102102 design/*.md
103103 design/*.png
104104 design/*.rst
105− docs/Overview.md
106− docs/Build.md
107− docs/streamly-vs-async.md
108− docs/streamly-vs-lists.md
109− docs/transformers.md
105+ docs/*.md
106+ docs/Setup.hs
107+ docs/Tutorial.hs
108+ docs/doctests.hs
109+ docs/streamly-docs.cabal
110110 examples/README.md
111111 src/Streamly/Internal/Data/Stream/Instances.hs
112112 src/Streamly/Internal/Data/Time/Clock/config-clock.h
@@ -360,9 +360,6 @@ library
360360 , Streamly.Network.Socket
361361 , Streamly.Network.Inet.TCP
362362
363− -- documentation
364− , Streamly.Tutorial
365−
366363 -- Deprecated
367364 , Streamly
368365 , Streamly.Data.Unicode.Stream
@@ -547,8 +544,8 @@ test-suite doctests
547544 if flag(doctests)
548545 build-depends:
549546 base
550− , base-compat >=0.10.5 && <0.12
551− , doctest >=0.15 && <0.18
547+ , base-compat >= 0.10.5 && < 0.12
548+ , doctest >= 0.15 && < 0.19
552549 , streamly
553550 else
554551 buildable: False