The Curious Time-Traveling Reverse State Monad
July 8, 2018
Want to time travel? Try the little-known time-warping reverse state monad!
Here is a very simple programming exercise that even a beginner Haskell programmer should be able to complete in a few minutes: given a list of Int
s, can you produce a cumulative sum of those integers? For example, if we had the list [2, 3, 5, 7, 11, 13]
, we want to have [2, 5, 10, 17, 28, 41]
.