Skip to content

Instantly share code, notes, and snippets.

@mvarela
Created January 13, 2012 14:06
Show Gist options
  • Select an option

  • Save mvarela/1606371 to your computer and use it in GitHub Desktop.

Select an option

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