Created
January 15, 2014 20:31
-
-
Save joshrotenberg/8443959 to your computer and use it in GitHub Desktop.
From http://hackage.haskell.org/package/hylolib-1.4.0/docs/src/HyLo-Util.html, modified slightly to not return the final item in the list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sequenceUntil :: Monad m => (a -> Bool) -> [m a] -> m [a] | |
| sequenceUntil _ [] = return [] | |
| sequenceUntil p (m:ms) = do a <- m | |
| if p a | |
| then return $ init [a] | |
| else do as <- sequenceUntil p ms | |
| return (a:as) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment