Last active
July 28, 2017 14:43
-
-
Save deque-blog/6b077772e86abca5ec91fc132bb56b4f to your computer and use it in GitHub Desktop.
This file contains 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
takingWhile : (a -> Bool) -> Transducer acc s s a a | |
takingWhile p = statelessTransducer $ | |
\next, acc, a => do | |
if p a -- If the element a satisfies the predicate | |
then next acc a -- * Then forwards it to the rest of the pipe-line | |
else pure (Done acc) -- * Else trigger an early termination |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment