File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -325,9 +325,13 @@ traverseM
325325 -> m (f (t b ))
326326traverseM f x = sequenceA <$> traverse f x
327327
328- -- | Apply a function @n@ times to a given value.
329- iterateN :: Int -> (a -> a ) -> a -> a
330- iterateN n f x = fix ((<*> (0 /= )) . ((bool x . f) . ) . (. pred )) $ n -- It is hard to read - yes. It is a single action without recursion - yes.
328+ iterateN
329+ :: forall a
330+ . Int -- ^ times
331+ -> (a -> a ) -- ^ function apply
332+ -> a -- ^ on value
333+ -> a
334+ iterateN n f x = fix ((<*> (0 /= )) . ((bool x . f) . ) . (. pred )) n -- It is hard to read - yes. It is a non-recursive momoized action - yes.
331335
332336-- | Apply Kleisli arrow N times, join 'm's.
333337nestM :: Monad m => Int -> (a -> m a ) -> a -> m a
You can’t perform that action at this time.
0 commit comments