diff options
Diffstat (limited to 'System/Random/Shuffle.hs')
-rw-r--r-- | System/Random/Shuffle.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/System/Random/Shuffle.hs b/System/Random/Shuffle.hs index 435f083..cc587da 100644 --- a/System/Random/Shuffle.hs +++ b/System/Random/Shuffle.hs @@ -74,7 +74,7 @@ shuffle elements = shuffleTree (buildTree elements) shuffleTree tree (r : rs) = let (b, rest) = extractTree r tree in b : shuffleTree rest rs shuffleTree _ _ = panic "[shuffle] called with lists of different lengths" - -- Extracts the n-th element from the tree and returns + -- Extracts the n-th element from the tree and pures -- that element, paired with a tree with the element -- deleted. -- The function maintains the invariant of the completeness @@ -112,9 +112,9 @@ shuffle' elements len = shuffle elements <. rseq len -- | shuffle' wrapped in a random monad shuffleM :: (MonadRandom m) => [a] -> m [a] shuffleM elements - | null elements = return [] + | null elements = pure [] | otherwise = shuffle elements <$> rseqM (length elements - 1) where rseqM :: (MonadRandom m) => Int -> m [Int] - rseqM 0 = return [] + rseqM 0 = pure [] rseqM i = liftM2 (:) (getRandomR (0, i)) (rseqM (i - 1)) |