ABSTRACT
We present a framework for constructing functional data structures that can be stored on disk. The data structures reside in a heap saved in a binary file. Operations read and write only the parts of the data structure that are actually needed. The framework is based on expressing datatypes as fixed points of functors and then annotating the recursive positions with additional information. We explain how functions, if expressed in terms of standard recursion patterns, can be easily lifted from a pure setting to an effectful, annotated scenario. As a running example, we sketch how to implement a persistent library of finite maps based on binary search trees.
Supplemental Material
- }}R. Backhouse, P. Jansson, J. Jeuring, and L. Meertens. Generic programming: An introduction. In Advanced Functional Programming, pages 28--115, 1998.Google Scholar
- }}D. Barry and T. Stanienda. Solving the Java object storage problem. Computer, 31:33--40, 1998. Google ScholarDigital Library
- }}R. Bird and L. Meertens. Nested datatypes. In Mathematics of Program Construction, pages 52--67. Springer, 1998. Google ScholarDigital Library
- }}T.-R. Chuang and S.-C. Mu. Out-of-core functional programming with type-based primitives. In Practical Aspects of Declarative Languages, 2000. Google ScholarDigital Library
- }}K. Claessen and D. Sands. Observable sharing for functional circuit description. In In Asian Computing Science Conference, pages 62--73. Springer, 1999. Google ScholarDigital Library
- }}A. G. Corona. TCache: A transactional data cache with configurable persistence, 2009. hackageDB: TCache.Google Scholar
- }}M. Fokkinga. Monadic maps and folds for arbitrary datatypes. Technical report, Memoranda Informatica 94--28, University of Twente, 1994.Google Scholar
- }}J. Garrigue. Code reuse through polymorphic variants. In Workshop on Foundations of Software Engineering, 2000.Google Scholar
- }}N. Ghani and P. Johann. Initial algebra semantics is enough! In Typed Lambda Calculus and Applications, number 4583 in LNCS, pages 207--222, 2007. Google ScholarDigital Library
- }}A. Gill. Type-safe observable sharing in Haskell. In ACM SIGPLAN Haskell Symposium, 2009. Google ScholarDigital Library
- }}T. Harris, S. Marlow, S. Peyton-Jones, and M. Herlihy. Composable memory transactions. In Principles and Practice of Parallel Programming, pages 48--60. ACM, 2005. Google ScholarDigital Library
- }}R. Hinze and R. Paterson. Finger trees: a simple general-purpose data structure. Journal of Functional Programming, 16(2):197--217, 2006. Google ScholarDigital Library
- }}R. Hinze, J. Jeuring, and A. Löh. Type-indexed data types. In Mathematics of Program Construction, LNCS, pages 148--174. Springer, 2002. Google ScholarDigital Library
- }}A. Jacobson. HAppS-State: Event-based distributed state, 2009. hackageDB: HAppS-State.Google Scholar
- }}P. Jansson and J. Jeuring. Polytypic data conversion programs. Science of Computer Programming, 43:2002, 2001. Google ScholarDigital Library
- }}P. Jansson and J. Jeuring. PolyP - a polytypic programming language extension. In Principles of Programming Languages, pages 470--482. ACM, 1997. Google ScholarDigital Library
- }}P. Johann. Foundations for structured programming with GADTs. In Principles of Programming Languages, pages 297--308, 2008. Google ScholarDigital Library
- }}O. Kiselyov. iteratee: Iteratee-based I/O, 2009. hackageDB: iteratee.Google Scholar
- }}L. Kolmodin and D. Stewart. binary: Binary serialisation for Haskell values using lazy ByteStrings, 2009. hackageDB: binary.Google Scholar
- }}L. Meertens. Paramorphisms. Formal Aspects of Computing, 4(5): 413--424, September 1992.Google ScholarCross Ref
- }}E. Meijer, M. Fokkinga, and R. Paterson. Functional programming with bananas, lenses, envelopes and barbed wire. In Functional Programming Languages and Computer Architecture, pages 124--144. Springer, 1991. Google ScholarDigital Library
- }}J. Nievergelt and E. M. Reingold. Binary search trees of bounded balance. In ACM symposium on Theory of computing, pages 137--142. ACM, 1972. Google ScholarDigital Library
- }}A. Rodriguez Yakushev, S. Holdermans, A. Löh, and J. Jeuring. Generic programming with fixed points for mutually recursive datatypes. In International Conference on Functional Programming, pages 233--244. ACM, 2009. Google ScholarDigital Library
- }}T. Sheard. Generic unification via two-level types and parameterized modules. In International Conference on Functional Programming, pages 86--97. ACM, 2001. Google ScholarDigital Library
- }}S. Smetsers, A. van Weelden, and R. Plasmeijer. Efficient and typesafe generic data storage. In Workshop on Generative Technologies, Budapest, Hungary, April 5 2008. Electronic Notes in Theoretical Computer Science.Google Scholar
- }}W. Swierstra. Data types à la carte. Journal of Functional Programming, 18(4):423--436, 2008. Google ScholarDigital Library
- }}T. Uustalu and V. Vene. Primitive (co)recursion and course-of-value (co)iteration, categorically. Informatica, 10:5--26, 1999.Google Scholar
- }}T. van Noort, A. Rodriguez, S. Holdermans, J. Jeuring, and B. Heeren. A lightweight approach to datatype-generic rewriting. In Workshop on Generic Programming, pages 13--24. ACM, 2008. Google ScholarDigital Library
- }}M. van Steenbergen, J. P. Magalhães, and J. Jeuring. Generic selections of subexpressions. In Workshop on Generic Programming. ACM, 2010. Google ScholarDigital Library
- }}V. Vene and T. Uustalu. Functional programming with apomorphisms (corecursion). In Nordic Workshop on Programming Theory, 1998.Google Scholar
- }}S. Visser. A generic approach to datatype persistency in Haskell. Master's thesis, Utrecht University, 2010. URL http://github.com/sebastiaanvisser/msc-thesis/downloads.Google Scholar
Index Terms
- Generic storage in Haskell
Recommendations
Generic selections of subexpressions
WGP '10: Proceedings of the 6th ACM SIGPLAN workshop on Generic programmingTools for computer languages need position information: compilers for providing better error messages, structure editors for mapping between structural and textual views, and debuggers for navigating through a term, for instance. Manually adding ...
Generic conversions of abstract syntax representations
WGP '12: Proceedings of the 8th ACM SIGPLAN workshop on Generic programmingIn this paper we present a datatype-generic approach to syntax with variable binding. A universe specifies the binding and scoping structure of object languages, including binders that bind multiple variables as well as sequential and recursive scoping. ...
Comments