diff --git a/Changelog.md b/Changelog.md index 2b345c5..330ca99 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,8 @@ +# 0.1.3.1 + +- Fix linking issue `symbol not found in flat namespace '_kSecRandomDefault'` + when using splitmix in TH on macOS. + # 0.1.3 - Use system specific entropy/randomess sources to initialise the default generator. diff --git a/splitmix.cabal b/splitmix.cabal index f732c4f..f64a8f0 100644 --- a/splitmix.cabal +++ b/splitmix.cabal @@ -1,6 +1,6 @@ cabal-version: 2.4 name: splitmix -version: 0.1.3 +version: 0.1.3.1 synopsis: Fast Splittable PRNG description: Pure Haskell implementation of SplitMix described in @@ -95,8 +95,8 @@ library c-sources: cbits-win/init.c elif (os(osx) || os(ios)) - c-sources: cbits-apple/init.c - ld-options: -framework Security + c-sources: cbits-apple/init.c + frameworks: Security else c-sources: cbits-unix/init.c @@ -239,3 +239,14 @@ test-suite initialization , base , HUnit >=1.6.0.0 && <1.7 , splitmix + +test-suite splitmix-th-test + default-language: Haskell2010 + type: exitcode-stdio-1.0 + ghc-options: -Wall -threaded -rtsopts + hs-source-dirs: tests + main-is: splitmix-th-test.hs + build-depends: + , base + , template-haskell + , splitmix diff --git a/tests/splitmix-th-test.hs b/tests/splitmix-th-test.hs new file mode 100644 index 0000000..d56fd5c --- /dev/null +++ b/tests/splitmix-th-test.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE TemplateHaskell #-} +module Main (main) where + +import Language.Haskell.TH.Syntax + +import System.Random.SplitMix + +main :: IO () +main = print val where + val :: Double + val = $(runIO (newSMGen >>= \g -> return (fst (nextDouble g))) >>= lift)