Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active July 28, 2017 17:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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