Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active July 16, 2017 19:19
  • 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?
reduce : (Foldable t) => Reducer st acc elem -> acc -> t elem -> acc
reduce step acc =
uncurry (complete step) -- 4) Call the completion on the result
. (\(acc, s) => (s, unStatus acc)) -- 3) Remove the wrapping status
. (flip runState (state step)) -- 2) Remove the state monad
. runSteps (runStep step) acc -- 1) Consume as many value as needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment