Purely Functional Incremental Computing
Many applications have to maintain evolving data sources as well as views on these sources. If sources change, the corresponding views have to be adapted. Complete recomputation of views is typically too expensive. An alternative is to convert source changes into view changes and apply these to the views. This is the key idea of incremental computing. In this paper, we use Haskell to develop an incremental computing framework. We illustrate the concepts behind this framework by implementing several example computations on sequences. Our framework allows the user to implement incremental computations using arbitrary monad families that encapsulate mutable state. This makes it possible to use highly efficient algorithms for core computations.
We want to thank Umut Acar, Yan Chen, Paolo Giarrusso, Magnús Halldórsson, Giuseppe Italiano, and Tarmo Uustalu for helpful discussions about the topics of this paper. This research was supported by the Estonian Research Council through the individual research grant PUT763, by the ERDF through the national ICTP project Coinduction for Semantics, Analysis, and Verification of Communicating and Concurrent Reactive Software, and by the Estonian Science Foundation through Grant 9398.
- 1.Acar, U.A.: Self-adjusting computation. Ph.D. thesis, Carnegie Mellon University, Pittsburgh, Pennsylvania, May 2005Google Scholar
- 2.Acar, U.A., Blelloch, G., Ley-Wild, R., Tangwongsan, K., Turkoglu, D.: Traceable data types for self-adjusting computation. In: Proceedings of the 31st ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2010), pp. 483–496. ACM, New York (2010)Google Scholar
- 3.Cai, Y., Giarrusso, P.G., Rendel, T., Ostermann, K.: A theory of changes for higher-order languages: incrementalizing \(\lambda \)-calculi by static differentiation. In: Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 145–155. ACM, New York (2014)Google Scholar
- 4.Carlsson, M.: Monads for incremental computing. In: Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming, pp. 26–35. ACM, New York (2002)Google Scholar
- 5.Dietz, P.F., Sleator, D.D.: Two algorithms for maintaining order in a list. Technical report CMU-CS-88-113, Carnegie Mellon University, Pittsburgh, Pennsylvania (1988)Google Scholar
- 6.Firsov, D., Jeltsch, W.: incremental-computing-0.0.0.0, Haskell Cabal package, Feburary 2015. http://hackage.haskell.org/package/incremental-computing-0.0.0.0
- 7.Firsov, D., Jeltsch, W.: order-maintenance-0.1.1.0, Haskell Cabal package, November 2015. http://hackage.haskell.org/package/order-maintenance-0.1.1.0
- 8.Hammer, M.A., Phang, K.Y., Hicks, M., Foster, J.S.: Adapton: composable, demand-driven incremental computation. In: Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2014), pp. 156–166. ACM, New York (2014)Google Scholar