From 93c3e417e2c883e505f87e69afd0a7ad31a9180a Mon Sep 17 00:00:00 2001 From: Alexey Kuleshevich Date: Sun, 29 Oct 2023 14:12:45 +0100 Subject: [PATCH 1/3] Stop using unsafeSTToPrim --- System/Random/MWC.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/System/Random/MWC.hs b/System/Random/MWC.hs index 726e603..5cc616b 100644 --- a/System/Random/MWC.hs +++ b/System/Random/MWC.hs @@ -159,7 +159,7 @@ module System.Random.MWC #endif import Control.Monad (ap, liftM, unless) -import Control.Monad.Primitive (PrimMonad, PrimBase, PrimState, unsafePrimToIO, unsafeSTToPrim) +import Control.Monad.Primitive (PrimMonad, PrimBase, PrimState, unsafePrimToIO, stToPrim) import Control.Monad.ST (ST,runST) import Data.Bits ((.&.), (.|.), shiftL, shiftR, xor) import Data.Int (Int8, Int16, Int32, Int64) @@ -463,7 +463,7 @@ instance (s ~ PrimState m, PrimMonad m) => Random.StatefulGen (Gen s) m where {-# INLINE uniformWord32 #-} uniformWord64 = uniform {-# INLINE uniformWord64 #-} - uniformShortByteString n g = unsafeSTToPrim (Random.genShortByteStringST n (uniform g)) + uniformShortByteString n g = stToPrim (Random.genShortByteStringST n (uniform g)) {-# INLINE uniformShortByteString #-} -- | @since 0.15.0.0 From c30f24c3b9823e809275a2d48ec17494ff6d2572 Mon Sep 17 00:00:00 2001 From: Alexey Kuleshevich Date: Fri, 24 Nov 2023 18:21:26 +0100 Subject: [PATCH 2/3] Get rid of compilation warning on Windows --- System/Random/MWC/SeedSource.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/System/Random/MWC/SeedSource.hs b/System/Random/MWC/SeedSource.hs index 31b1931..fa4f333 100644 --- a/System/Random/MWC/SeedSource.hs +++ b/System/Random/MWC/SeedSource.hs @@ -22,9 +22,10 @@ import Foreign.Marshal.Array (peekArray) #if defined(mingw32_HOST_OS) import Foreign.Ptr import Foreign.C.Types +#else +import System.IO (IOMode(..), hGetBuf, withBinaryFile) #endif import System.CPUTime (cpuTimePrecision, getCPUTime) -import System.IO (IOMode(..), hGetBuf, withBinaryFile) -- Acquire seed from current time. This is horrible fallback for -- Windows system. From a801bf449e100c907a0f6817725aff94fcd81fd3 Mon Sep 17 00:00:00 2001 From: Alexey Kuleshevich Date: Fri, 24 Nov 2023 18:28:24 +0100 Subject: [PATCH 3/3] allow-newer in cabal.project is no longer required --- cabal.project | 3 --- 1 file changed, 3 deletions(-) diff --git a/cabal.project b/cabal.project index 7d2ea14..74a6c9c 100644 --- a/cabal.project +++ b/cabal.project @@ -1,5 +1,2 @@ packages: mwc-random.cabal - -allow-newer:QuickCheck:splitmix -allow-newer:QuickCheck:random