on master help sign in
Merge pull request #89 from timbuckley/patch-1

(m) Use more Haskell syntax highlighting in README

commit2af38332b8d5b2f5e02c2cbe95911da97c3d43cc authorHarendra Kumar <harendra.kumar@gmail.com> dateWed 18 Jul 2018, 23:58 (8 years ago) parent6ab3ce0574e745
1 file changed+7−7
README.md+7−7
README.md+7−7
@@ -84,7 +84,7 @@ The following snippet provides a simple stream composition example that reads
8484numbers from stdin, prints the squares of even numbers and exits if an even
8585number more than 9 is entered.
8686
87−```haskell
87+``` haskell
8888import Streamly
8989import qualified Streamly.Prelude as S
9090import Data.Function ((&))
@@ -107,7 +107,7 @@ when used with appropriate stream type combinator (e.g. `asyncly`, `aheadly` or
107107
108108The following code finishes in 3 seconds (6 seconds when serial):
109109
110−```
110+``` haskell
111111> let p n = threadDelay (n * 1000000) >> return n
112112> S.toList $ aheadly $ p 3 |: p 2 |: p 1 |: S.nil
113113[3,2,1]
@@ -118,7 +118,7 @@ The following code finishes in 3 seconds (6 seconds when serial):
118118
119119The following finishes in 10 seconds (100 seconds when serial):
120120
121−```
121+``` haskell
122122runStream $ asyncly $ S.replicateM 10 $ p 10
123123```
124124
@@ -129,7 +129,7 @@ following example prints a "hello" every second; if you use `&` instead of
129129`|&` you will see that the delay doubles to 2 seconds instead because of serial
130130application.
131131
132−```
132+``` haskell
133133main = runStream $
134134 S.repeatM (threadDelay 1000000 >> return "hello")
135135 |& S.mapM (\x -> threadDelay 1000000 >> putStrLn x)
@@ -139,7 +139,7 @@ main = runStream $
139139
140140We can use `mapM` or `sequence` functions concurrently on a stream.
141141
142−```
142+``` haskell
143143> let p n = threadDelay (n * 1000000) >> return n
144144> runStream $ aheadly $ S.mapM (\x -> p 1 >> print x) (serially $ repeatM (p 1))
145145```
@@ -176,7 +176,7 @@ delay n = S.yieldM $ do
176176```
177177### Serial
178178
179−```haskell
179+``` haskell
180180main = runStream $ delay 3 <> delay 2 <> delay 1
181181```
182182```
@@ -187,7 +187,7 @@ ThreadId 36: Delay 1
187187
188188### Parallel
189189
190−```haskell
190+``` haskell
191191main = runStream . parallely $ delay 3 <> delay 2 <> delay 1
192192```
193193```