File tree Expand file tree Collapse file tree
src/System/Random/SplitMix Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ library
8484 -- because it's valuable that splitmix and QuickCheck doesn't
8585 -- depend on about anything
8686
87- if impl(ghcjs)
87+ if impl(ghcjs) || arch(javascript)
8888 cpp-options : -DSPLITMIX_INIT_GHCJS= 1
8989
9090 else
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ module System.Random.SplitMix.Init (
66
77import Data.Word (Word64 )
88
9- #if defined(SPLITMIX_INIT_GHCJS) && __GHCJS__
9+ #if defined(SPLITMIX_INIT_GHCJS) && ( __GHCJS__ || defined(javascript_HOST_ARCH))
1010
1111import Data.Word (Word32 )
1212
@@ -26,12 +26,17 @@ import System.CPUTime (cpuTimePrecision, getCPUTime)
2626
2727initialSeed :: IO Word64
2828
29- #if defined(SPLITMIX_INIT_GHCJS) && __GHCJS__
29+ #if defined(SPLITMIX_INIT_GHCJS) && ( __GHCJS__ || defined(javascript_HOST_ARCH))
3030
3131initialSeed = fmap fromIntegral initialSeedJS
3232
3333foreign import javascript
34+ #if __GHCJS__
3435 " $r = Math.floor(Math.random()*0x100000000);"
36+ #else
37+ -- defined(javascript_HOST_ARCH)
38+ " (() => { return Math.floor(Math.random()*0x100000000); })"
39+ #endif
3540 initialSeedJS :: IO Word32
3641
3742#else
@@ -56,3 +61,4 @@ initialSeed = do
5661
5762#endif
5863#endif
64+
You can’t perform that action at this time.
0 commit comments