Skip to content

Instantly share code, notes, and snippets.

@deque-blog

deque-blog/iterating.idr

Last active Oct 31, 2017
Embed
What would you like to do?
iterating : (Monad m) => (a -> a) -> a -> Source m a
iterating f = recur where
recur a = do
yield a -- Yield the value downstream
recur (f a) -- Recurse with (f a) as next seed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment