on master help sign in
(m) Use more Haskell syntax highlighting in README
574e745Tim Buckley
README.md+7−7
@@ -84,7 +84,7 @@ The following snippet provides a simple stream composition example that reads
84numbers from stdin, prints the squares of even numbers and exits if an even
84numbers from stdin, prints the squares of even numbers and exits if an even
85number more than 9 is entered.
85number more than 9 is entered.
86
86
87−```haskell
87+``` haskell
88import Streamly
88import Streamly
89import qualified Streamly.Prelude as S
89import qualified Streamly.Prelude as S
90import Data.Function ((&))
90import Data.Function ((&))
@@ -107,7 +107,7 @@ when used with appropriate stream type combinator (e.g. `asyncly`, `aheadly` or
107
107
108The following code finishes in 3 seconds (6 seconds when serial):
108The following code finishes in 3 seconds (6 seconds when serial):
109
109
110−```
110+``` haskell
111> let p n = threadDelay (n * 1000000) >> return n
111> let p n = threadDelay (n * 1000000) >> return n
112> S.toList $ aheadly $ p 3 |: p 2 |: p 1 |: S.nil
112> S.toList $ aheadly $ p 3 |: p 2 |: p 1 |: S.nil
113[3,2,1]
113[3,2,1]
@@ -118,7 +118,7 @@ The following code finishes in 3 seconds (6 seconds when serial):
118
118
119The following finishes in 10 seconds (100 seconds when serial):
119The following finishes in 10 seconds (100 seconds when serial):
120
120
121−```
121+``` haskell
122runStream $ asyncly $ S.replicateM 10 $ p 10
122runStream $ asyncly $ S.replicateM 10 $ p 10
123```
123```
124
124
@@ -129,7 +129,7 @@ following example prints a "hello" every second; if you use `&` instead of
129`|&` you will see that the delay doubles to 2 seconds instead because of serial
129`|&` you will see that the delay doubles to 2 seconds instead because of serial
130application.
130application.
131
131
132−```
132+``` haskell
133main = runStream $
133main = runStream $
134 S.repeatM (threadDelay 1000000 >> return "hello")
134 S.repeatM (threadDelay 1000000 >> return "hello")
135 |& S.mapM (\x -> threadDelay 1000000 >> putStrLn x)
135 |& S.mapM (\x -> threadDelay 1000000 >> putStrLn x)
@@ -139,7 +139,7 @@ main = runStream $
139
139
140We can use `mapM` or `sequence` functions concurrently on a stream.
140We can use `mapM` or `sequence` functions concurrently on a stream.
141
141
142−```
142+``` haskell
143> let p n = threadDelay (n * 1000000) >> return n
143> let p n = threadDelay (n * 1000000) >> return n
144> runStream $ aheadly $ S.mapM (\x -> p 1 >> print x) (serially $ repeatM (p 1))
144> runStream $ aheadly $ S.mapM (\x -> p 1 >> print x) (serially $ repeatM (p 1))
145```
145```
@@ -176,7 +176,7 @@ delay n = S.yieldM $ do
176```
176```
177### Serial
177### Serial
178
178
179−```haskell
179+``` haskell
180main = runStream $ delay 3 <> delay 2 <> delay 1
180main = runStream $ delay 3 <> delay 2 <> delay 1
181```
181```
182```
182```
@@ -187,7 +187,7 @@ ThreadId 36: Delay 1
187
187
188### Parallel
188### Parallel
189
189
190−```haskell
190+``` haskell
191main = runStream . parallely $ delay 3 <> delay 2 <> delay 1
191main = runStream . parallely $ delay 3 <> delay 2 <> delay 1
192```
192```
193```
193```