From 264e81c430ecbbbfa2bb610aa0dd1f6f16c928dd Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 29 Dec 2016 11:23:22 -0800 Subject: [PATCH] lib: applyN comment --- hledger-lib/Hledger/Utils.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hledger-lib/Hledger/Utils.hs b/hledger-lib/Hledger/Utils.hs index c05fdab90..554ce4096 100644 --- a/hledger-lib/Hledger/Utils.hs +++ b/hledger-lib/Hledger/Utils.hs @@ -125,6 +125,9 @@ isRight = not . isLeft -- | Apply a function the specified number of times. Possibly uses O(n) stack ? applyN :: Int -> (a -> a) -> a -> a applyN n f = (!! n) . iterate f +-- from protolude, compare +-- applyN :: Int -> (a -> a) -> a -> a +-- applyN n f = X.foldr (.) identity (X.replicate n f) -- | Convert a possibly relative, possibly tilde-containing file path to an absolute one, -- given the current directory. ~username is not supported. Leave "-" unchanged.