Last active
July 16, 2017 19:21
-
-
Save deque-blog/e6d3f14f2541785b92356781c6c83216 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
runSteps : (Foldable t) => Step st acc elem -> acc -> t elem -> State st (Status acc) | |
runSteps step acc elems = | |
foldr stepImpl (pure . id) elems (Continue acc) -- Using continuation passing style | |
where | |
stepImpl _ nextIteration (Done acc) = pure (Done acc) | |
stepImpl e nextIteration (Continue acc) = step acc e >>= nextIteration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment