Two models for integrating persistence and lazy functional languages
A new programming system -STAPLE (Statically Typed Applicative Persistent Language Environment) -which integrates a lazy functional programming language and a persistent store is described. The motivation for introducing orthogonal persistence into a functional setting is given. Two models for achieving this integration are then described together with a discussion of the way laziness interacts with persistence and the benefits resulting from this interaction. In the first model, a system of
... sistent modules allows the programmer to create persistent values by naming them in a module. In the second model, a combination of stream I/O and a dynamic type allows functional programs to manipulate values already in the persistent store and to allow dynamically created values to become persistent. Introduction The integration of persistence and lazy functional programming languages promises to reduce the complexity and improve the efficiency of functional programs. In addition, a persistent functional programming system facilitates the construction of database applications. This paper describes two possible models of persistence for lazy functional languages. The first, persistence with modules, relies on static binding to objects in the persistent store (By 'object', we mean the concrete representation of a value). The ObServer object-oriented database system has a similar mechanism for binding [Horn87] . The second, stream persistence, provides a more flexible mechanism which supports dynamic binding to objects in the persistent store. This second approach is found in non-functional languages including Amber[Card83] and Napier88[Morr89]. The Staple functional programming system[Davi90] incorporates both these models within a single programming system. This section examines the reasons for using functional languages, lazy evaluation and persistence. Section 2 describes the first model of persistence based on modules. Section 3 describes the second model -stream persistence. Examples of both models are given in sections 2 and 3. Section 4 concludes., and a description of the Staple language is included as an Appendix.