Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active October 31, 2017 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deque-blog/79ed5e26806cbec6c69c2d44944bda34 to your computer and use it in GitHub Desktop.
Save deque-blog/79ed5e26806cbec6c69c2d44944bda34 to your computer and use it in GitHub Desktop.
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