From 8a224602efea99995ba531a2488c38cf814be47f Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sat, 11 May 2024 13:57:15 +0300 Subject: [PATCH] Add strictness to sampling from CT When result is returned strictly GHC is able to unbox it. --- System/Random/MWC/CondensedTable.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/System/Random/MWC/CondensedTable.hs b/System/Random/MWC/CondensedTable.hs index e7ff735..8a6f0d7 100644 --- a/System/Random/MWC/CondensedTable.hs +++ b/System/Random/MWC/CondensedTable.hs @@ -79,7 +79,7 @@ genFromTable :: (StatefulGen g m, Vector v a) => CondensedTable v a -> g -> m a {-# INLINE genFromTable #-} genFromTable table gen = do w <- uniformM gen - return $ lookupTable table $ fromIntegral (w :: Word32) + return $! lookupTable table $ fromIntegral (w :: Word32) lookupTable :: Vector v a => CondensedTable v a -> Word64 -> a {-# INLINE lookupTable #-}