Last active
July 28, 2017 17:49
-
-
Save deque-blog/713a206564c69f57fe5379618e2d5960 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
taking : Nat -> Transducer acc s (Nat, s) a a | |
taking n = statefulTransducer n takeImpl | |
where | |
takeImpl next (Z, acc) a = pure (Done (Z, acc)) | |
takeImpl next (n, acc) a = withState (pred n) <$> next acc a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment