From b289dee25ad8ce4c2622fadb2f4c31fb90914b39 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Fri, 29 Jan 2021 02:37:14 -0500 Subject: Lint 'return' into 'pure', replace bind operator --- System/Random/Shuffle.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'System/Random') 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)) -- cgit v1.2.3