on master help sign in
Add GHCJS support
c86b673Harendra Kumar
Changelog.md+6
@@ -1,3 +1,9 @@
1+## Unreleased
2+
3+### Enhancements
4+
5+* Add GHCJS support
6+
1## 0.6.0
7## 0.6.0
2
8
3### Breaking changes
9### Breaking changes
cabal.project.ghcjsnew file+12
@@ -0,0 +1,12 @@
1+compiler: ghcjs
2+packages: streamly.cabal
3+
4+source-repository-package
5+ type: git
6+ location: https://github.com/ghcjs/ghcjs-base
7+ tag: b8d51f65ae1921b2f031710bf75e17f216de442a
8+
9+source-repository-package
10+ type: git
11+ location: https://github.com/harendra-kumar/hs-gauge
12+ tag: 603dcf8c48f35e8a1ab3fc9838fbcde391bc842b
jsbits/clock.jsnew file+6
@@ -0,0 +1,6 @@
1+/* Hack! Supporting code for "clock" package
2+ * "hspec" depends on clock.
3+ */
4+function h$hs_clock_darwin_gettime(when, p_d, p_o) {
5+ h$clock_gettime(when, p_d, p_o);
6+}
streamly.cabal+5−2
@@ -210,6 +210,7 @@ library
210test-suite test
210test-suite test
211 type: exitcode-stdio-1.0
211 type: exitcode-stdio-1.0
212 main-is: Main.hs
212 main-is: Main.hs
213+ js-sources: jsbits/clock.js
213 hs-source-dirs: test
214 hs-source-dirs: test
214 ghc-options: -O0 -Wall -threaded -with-rtsopts=-N -fno-ignore-asserts
215 ghc-options: -O0 -Wall -threaded -with-rtsopts=-N -fno-ignore-asserts
215 if flag(dev)
216 if flag(dev)
@@ -287,6 +288,7 @@ test-suite test
287test-suite properties
288test-suite properties
288 type: exitcode-stdio-1.0
289 type: exitcode-stdio-1.0
289 main-is: Prop.hs
290 main-is: Prop.hs
291+ js-sources: jsbits/clock.js
290 hs-source-dirs: test
292 hs-source-dirs: test
291 ghc-options: -fno-ignore-asserts -Wall -O0 -threaded -with-rtsopts=-N
293 ghc-options: -fno-ignore-asserts -Wall -O0 -threaded -with-rtsopts=-N
292 if flag(dev)
294 if flag(dev)
@@ -316,6 +318,7 @@ test-suite maxrate
316 type: exitcode-stdio-1.0
318 type: exitcode-stdio-1.0
317 default-language: Haskell2010
319 default-language: Haskell2010
318 main-is: MaxRate.hs
320 main-is: MaxRate.hs
321+ js-sources: jsbits/clock.js
319 hs-source-dirs: test
322 hs-source-dirs: test
320 ghc-options: -fno-ignore-asserts -O2 -Wall -threaded -with-rtsopts=-N
323 ghc-options: -fno-ignore-asserts -O2 -Wall -threaded -with-rtsopts=-N
321 if flag(dev)
324 if flag(dev)
@@ -596,7 +599,7 @@ executable chart
596 default-language: Haskell2010
599 default-language: Haskell2010
597 hs-source-dirs: benchmark
600 hs-source-dirs: benchmark
598 main-is: Chart.hs
601 main-is: Chart.hs
599− if flag(dev)
602+ if flag(dev) && !impl(ghcjs)
600 buildable: True
603 buildable: True
601 build-Depends:
604 build-Depends:
602 base >= 4.8 && < 5
605 base >= 4.8 && < 5
@@ -614,7 +617,7 @@ executable SearchQuery
614 default-language: Haskell2010
617 default-language: Haskell2010
615 main-is: SearchQuery.hs
618 main-is: SearchQuery.hs
616 hs-source-dirs: examples
619 hs-source-dirs: examples
617− if flag(examples) || flag(examples-sdl)
620+ if (flag(examples) || flag(examples-sdl)) && !impl(ghcjs)
618 buildable: True
621 buildable: True
619 build-Depends:
622 build-Depends:
620 streamly
623 streamly
test/MaxRate.hs+36−7
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE FlexibleContexts #-}
2{-# LANGUAGE FlexibleContexts #-}
2
3
3import Streamly
4import Streamly
@@ -81,37 +82,65 @@ main = hspec $ do
81 -- will be effectively shorter. This becomes significant when the rates are
82 -- will be effectively shorter. This becomes significant when the rates are
82 -- lower (1 or lower). For rate 1 we lose 1 second in the end and for rate
83 -- lower (1 or lower). For rate 1 we lose 1 second in the end and for rate
83 -- 10 0.1 second.
84 -- 10 0.1 second.
84− let rates = [1, 10, 100, 1000, 10000, 100000, 1000000]
85+ let rates = [1, 10, 100, 1000, 10000
86+#ifndef __GHCJS__
87+ , 100000, 1000000
88+#endif
89+ ]
85 in describe "asyncly no consumer delay no producer delay" $
90 in describe "asyncly no consumer delay no producer delay" $
86 forM_ rates (\r -> measureRate "asyncly" asyncly r 0 0 range)
91 forM_ rates (\r -> measureRate "asyncly" asyncly r 0 0 range)
87
92
88 -- XXX try staggering the dispatches to achieve higher rates
93 -- XXX try staggering the dispatches to achieve higher rates
89− let rates = [1, 10, 100, 1000, 10000, 25000]
94+ let rates = [1, 10, 100, 1000
95+#ifndef __GHCJS__
96+ , 10000, 25000
97+#endif
98+ ]
90 in describe "asyncly no consumer delay and 1 sec producer delay" $
99 in describe "asyncly no consumer delay and 1 sec producer delay" $
91 forM_ rates (\r -> measureRate "asyncly" asyncly r 0 1 range)
100 forM_ rates (\r -> measureRate "asyncly" asyncly r 0 1 range)
92
101
93 -- At lower rates (1/10) this is likely to vary quite a bit depending on
102 -- At lower rates (1/10) this is likely to vary quite a bit depending on
94 -- the spread of random producer latencies generated.
103 -- the spread of random producer latencies generated.
95− let rates = [1, 10, 100, 1000, 10000, 25000]
104+ let rates = [1, 10, 100, 1000
105+#ifndef __GHCJS__
106+ , 10000, 25000
107+#endif
108+ ]
96 in describe "asyncly no consumer delay and variable producer delay" $
109 in describe "asyncly no consumer delay and variable producer delay" $
97 forM_ rates $ \r ->
110 forM_ rates $ \r ->
98 measureRate' "asyncly" asyncly r 0 (0.1, 3) range
111 measureRate' "asyncly" asyncly r 0 (0.1, 3) range
99
112
100− let rates = [1, 10, 100, 1000, 10000, 100000, 1000000]
113+ let rates = [1, 10, 100, 1000, 10000
114+#ifndef __GHCJS__
115+ , 100000, 1000000
116+#endif
117+ ]
101 in describe "wAsyncly no consumer delay no producer delay" $
118 in describe "wAsyncly no consumer delay no producer delay" $
102 forM_ rates (\r -> measureRate "wAsyncly" wAsyncly r 0 0 range)
119 forM_ rates (\r -> measureRate "wAsyncly" wAsyncly r 0 0 range)
103
120
104− let rates = [1, 10, 100, 1000, 10000, 25000]
121+ let rates = [1, 10, 100, 1000
122+#ifndef __GHCJS__
123+ , 10000, 25000
124+#endif
125+ ]
105 in describe "wAsyncly no consumer delay and 1 sec producer delay" $
126 in describe "wAsyncly no consumer delay and 1 sec producer delay" $
106 forM_ rates (\r -> measureRate "wAsyncly" wAsyncly r 0 1 range)
127 forM_ rates (\r -> measureRate "wAsyncly" wAsyncly r 0 1 range)
107
128
108− let rates = [1, 10, 100, 1000, 10000, 100000, 1000000]
129+ let rates = [1, 10, 100, 1000, 10000
130+#ifndef __GHCJS__
131+ , 100000, 1000000
132+#endif
133+ ]
109 in describe "aheadly no consumer delay no producer delay" $
134 in describe "aheadly no consumer delay no producer delay" $
110 forM_ rates (\r -> measureRate "aheadly" aheadly r 0 0 range)
135 forM_ rates (\r -> measureRate "aheadly" aheadly r 0 0 range)
111
136
112 -- XXX after the change to stop workers when the heap is clearing
137 -- XXX after the change to stop workers when the heap is clearing
113 -- thi does not work well at a 25000 ops per second, need to fix.
138 -- thi does not work well at a 25000 ops per second, need to fix.
114− let rates = [1, 10, 100, 1000, 10000, 12500]
139+ let rates = [1, 10, 100, 1000
140+#ifndef __GHCJS__
141+ , 10000, 12500
142+#endif
143+ ]
115 in describe "aheadly no consumer delay and 1 sec producer delay" $
144 in describe "aheadly no consumer delay and 1 sec producer delay" $
116 forM_ rates (\r -> measureRate "aheadly" aheadly r 0 1 range)
145 forM_ rates (\r -> measureRate "aheadly" aheadly r 0 1 range)
117
146