Skip to content

Instantly share code, notes, and snippets.

@mwotton
Created March 6, 2012 12:23
Show Gist options
  • Save mwotton/1986002 to your computer and use it in GitHub Desktop.
Save mwotton/1986002 to your computer and use it in GitHub Desktop.
name this operator
whileJust :: Monad m => (b -> m (Maybe b)) -> b -> m b
whileJust action seed = action seed >>= maybe (return seed) (whileJust action)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment