@@ -1,14 +1,26 @@
1# Using `streamly` package
1# Using `streamly` package
3+If you are new to Haskell please take a look at [Haskell Getting Started
4+Guide](https://github.com/composewell/haskell-dev/blob/master/getting-started.rst).
6+The following instructions assume that you are using a shell on a POSIX
7+system. On Windows you need a shell under `msys`, some of the commands
8+may have slight differences.
10+## Which version to use?
3* [Latest stable release](https://hackage.haskell.org/package/streamly) is available on
12* [Latest stable release](https://hackage.haskell.org/package/streamly) is available on
5* [Latest development version](https://github.com/composewell/streamly) is
14* [Latest development version](https://github.com/composewell/streamly) is
6 available on github.
15 available on github.
7−* See [recommended compilation options here](docs/Build.md).
9If you are using `stack` or `nix` please make sure to add the latest version
17If you are using `stack` or `nix` please make sure to add the latest version
10from Hackage to your tool configuration.
18from Hackage to your tool configuration.
20+## Recommended build options
22+See [recommended compilation options here](docs/Build.md).
12## Using with `cabal`
24## Using with `cabal`
14Make sure you have `cabal` version 3.0 or later installed and you have `ghc`
26Make sure you have `cabal` version 3.0 or later installed and you have `ghc`
@@ -18,20 +30,47 @@ available in your PATH. Refresh your package list:
18$ cabal update
30$ cabal update
33+Create a directory for isolated builds:
39+Create a `.cabal` file:
43+$ cabal init --minimal --dependency base --dependency streamly
46+You can add any other dependencies as well later on by editing the
47+`build-depends` section of the cabal file.
21### Using hackage version in repl
49### Using hackage version in repl
51+Run repl with the latest version from Hackage:
24−# Run repl with the latest version from Hackage
25$ cabal repl --build-depends streamly
54$ cabal repl --build-depends streamly
55+GHCi, version 8.8.3: https://www.haskell.org/ghc/ :? for help
56+[1 of 1] Compiling Main ( Main.hs, interpreted )
57+Ok, one module loaded.
58+*Main> S.drain $ S.mapM print $ S.fromList [1..3]
27−# Run repl with a specific version from Hackage
65+Run repl with a specific version from Hackage:
28−$ cabal repl --build-depends streamly==0.7.1
68+$ cabal repl --build-depends streamly==0.7.2
31### Using github version in repl
71### Using github version in repl
33−Create a directory for your playground (e.g. `test`) and create a
34−`cabal.project` file in it as follows:
73+Create a `cabal.project` file with the following contents:
37packages: .
76packages: .
@@ -41,48 +80,27 @@ source-repository-package
41 tag: master
80 tag: master
44−Create a cabal file (e.g. `test.cabal`) as follows
52− build-depends: base, streamly
58$ cabal repl
86$ cabal repl
61−### Using with ghc or ghci
89+### Hello World!
63−Before you can use a package with `ghc` or `ghci` directly you need to install
91+Edit `Main.hs` as follows:
67−$ cabal install streamly-0.7.1 --lib
94+module Main where
72import qualified Streamly.Prelude as S
96import qualified Streamly.Prelude as S
74−main = S.runStream $ S.fromListM [putStrLn "hello", putStrLn "world"]
98+main :: IO ()
99+main = S.drain $ S.mapM print $ S.fromList [1..3]
78−$ ghc hello.hs
105+$ cabal run
81−### Using in a Project
83−Add `streamly` to the `build-depends` section of your library/executable in
84−your `<package>.cabal` file. Appropriate version from Hackage will be picked
85−depending on the version bounds that you specify. See the `github version in
86−repl` section above for a sample `<package>.cabal` file and optionally use the
87−`cabal.project` file if you want to use the development version from github in