Skip to content

Instantly share code, notes, and snippets.

@kindaro
Created May 15, 2018 19:07
Show Gist options
  • Save kindaro/977a1e11613370b5d89bba3ba9d8fcb5 to your computer and use it in GitHub Desktop.
Save kindaro/977a1e11613370b5d89bba3ba9d8fcb5 to your computer and use it in GitHub Desktop.
whileM :: Monad m => MaybeT m a -> m a
whileM = fix $ \f x -> maybe (f x) return =<< runMaybeT x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment