From cdcf3a332602ae8b0a61069f23dc4b87aa573835 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Mon, 5 Sep 2022 16:27:21 +0000 Subject: [PATCH] Control.Applicative.Local: Rename parameter to avoid confusing name shadowing --- src/Control/Applicative/Local.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Control/Applicative/Local.hs b/src/Control/Applicative/Local.hs index cba8830..7778394 100644 --- a/src/Control/Applicative/Local.hs +++ b/src/Control/Applicative/Local.hs @@ -23,28 +23,28 @@ where import Control.Applicative --- | Apply action between zero and @n@ times, inclusive, and list the results. +-- | Apply action between zero and @times@ times, inclusive, and list the results. atMost :: Alternative f => Int -> f a -> f [a] -atMost n action = go n +atMost times action = go times where go n = if n <= 0 then pure [] else liftA2 (:) action (go $ n - 1) <|> pure [] --- | Apply action between zero and @n@ times, inclusive, and discard results. +-- | Apply action between zero and @times@ times, inclusive, and discard results. atMost_ :: Alternative f => Int -> f a -> f () -atMost_ n action = go n +atMost_ times action = go times where go n = if n <= 0 then pure () else action *> (go $ n - 1) <|> pure () --- | Apply action between one and @n@ times, inclusive, and list the results. +-- | Apply action between one and @times@ times, inclusive, and list the results. upTo :: Alternative f => Int -> f a -> f [a] -upTo n action = liftA2 (:) action $ atMost n action +upTo times action = liftA2 (:) action $ atMost times action --- | Apply action between one and @n@ times, inclusive, and discard results. +-- | Apply action between one and @times@ times, inclusive, and discard results. upTo_ :: Alternative f => Int -> f a -> f () -upTo_ n action = action *> atMost_ n action +upTo_ times action = action *> atMost_ times action