Skip to content

Commit

Permalink
Strict accumulators
Browse files Browse the repository at this point in the history
  • Loading branch information
curiousleo committed Apr 7, 2020
1 parent ef71573 commit 6f1abb9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions System/Random.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
Expand Down Expand Up @@ -1124,7 +1125,7 @@ boundedExclusiveIntegerM s gen = go
integerWordSize :: Integer -> Int
integerWordSize = go 0
where
go acc i
go !acc i
| i == 0 = acc
| otherwise = go (acc + 1) (i `shiftR` WORD_SIZE_IN_BITS)
{-# INLINE integerWordSize #-}
Expand All @@ -1134,7 +1135,7 @@ integerWordSize = go 0
uniformIntegerWords :: (MonadRandom g m) => Int -> g -> m Integer
uniformIntegerWords n gen = go 0 n
where
go acc i
go !acc i
| i == 0 = return acc
| otherwise = do
(w :: Word) <- uniform gen
Expand Down

0 comments on commit 6f1abb9

Please sign in to comment.