Skip to content

Commit 3e54d3b

Browse files
authored
Merge pull request #99 from haskellari/th-test
Add test using splitmix in TH
2 parents 047c4f7 + a207f2b commit 3e54d3b

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

Changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 0.1.3.1
2+
3+
- Fix linking issue `symbol not found in flat namespace '_kSecRandomDefault'`
4+
when using splitmix in TH on macOS.
5+
16
# 0.1.3
27

38
- Use system specific entropy/randomess sources to initialise the default generator.

splitmix.cabal

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.4
22
name: splitmix
3-
version: 0.1.3
3+
version: 0.1.3.1
44
synopsis: Fast Splittable PRNG
55
description:
66
Pure Haskell implementation of SplitMix described in
@@ -95,8 +95,8 @@ library
9595
c-sources: cbits-win/init.c
9696

9797
elif (os(osx) || os(ios))
98-
c-sources: cbits-apple/init.c
99-
ld-options: -framework Security
98+
c-sources: cbits-apple/init.c
99+
frameworks: Security
100100

101101
else
102102
c-sources: cbits-unix/init.c
@@ -239,3 +239,14 @@ test-suite initialization
239239
, base
240240
, HUnit >=1.6.0.0 && <1.7
241241
, splitmix
242+
243+
test-suite splitmix-th-test
244+
default-language: Haskell2010
245+
type: exitcode-stdio-1.0
246+
ghc-options: -Wall -threaded -rtsopts
247+
hs-source-dirs: tests
248+
main-is: splitmix-th-test.hs
249+
build-depends:
250+
, base
251+
, template-haskell
252+
, splitmix

tests/splitmix-th-test.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{-# LANGUAGE TemplateHaskell #-}
2+
module Main (main) where
3+
4+
import Language.Haskell.TH.Syntax
5+
6+
import System.Random.SplitMix
7+
8+
main :: IO ()
9+
main = print val where
10+
val :: Double
11+
val = $(runIO (newSMGen >>= \g -> return (fst (nextDouble g))) >>= lift)

0 commit comments

Comments
 (0)