Skip to content

Instantly share code, notes, and snippets.

@mvarela
Created January 13, 2012 14:06
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 mvarela/1606371 to your computer and use it in GitHub Desktop.
Save mvarela/1606371 to your computer and use it in GitHub Desktop.
-- What is a "for" construct, really? :)
for :: (Monad m) => (a, (a -> Bool), a -> a) -> (a -> m ()) -> m ()
for (i, cond, fStep) fm = mapM_ fm $ takeWhile cond $ iterate fStep i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment