skip to main content
10.1145/1863495.1863500acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Generic storage in Haskell

Published: 26 September 2010 Publication History

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.

Supplementary Material

MOV File (wgp-1110-loeh.mov)

References

[1]
}}R. Backhouse, P. Jansson, J. Jeuring, and L. Meertens. Generic programming: An introduction. In Advanced Functional Programming, pages 28--115, 1998.
[2]
}}D. Barry and T. Stanienda. Solving the Java object storage problem. Computer, 31:33--40, 1998.
[3]
}}R. Bird and L. Meertens. Nested datatypes. In Mathematics of Program Construction, pages 52--67. Springer, 1998.
[4]
}}T.-R. Chuang and S.-C. Mu. Out-of-core functional programming with type-based primitives. In Practical Aspects of Declarative Languages, 2000.
[5]
}}K. Claessen and D. Sands. Observable sharing for functional circuit description. In In Asian Computing Science Conference, pages 62--73. Springer, 1999.
[6]
}}A. G. Corona. TCache: A transactional data cache with configurable persistence, 2009. hackageDB: TCache.
[7]
}}M. Fokkinga. Monadic maps and folds for arbitrary datatypes. Technical report, Memoranda Informatica 94--28, University of Twente, 1994.
[8]
}}J. Garrigue. Code reuse through polymorphic variants. In Workshop on Foundations of Software Engineering, 2000.
[9]
}}N. Ghani and P. Johann. Initial algebra semantics is enough! In Typed Lambda Calculus and Applications, number 4583 in LNCS, pages 207--222, 2007.
[10]
}}A. Gill. Type-safe observable sharing in Haskell. In ACM SIGPLAN Haskell Symposium, 2009.
[11]
}}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.
[12]
}}R. Hinze and R. Paterson. Finger trees: a simple general-purpose data structure. Journal of Functional Programming, 16(2):197--217, 2006.
[13]
}}R. Hinze, J. Jeuring, and A. Löh. Type-indexed data types. In Mathematics of Program Construction, LNCS, pages 148--174. Springer, 2002.
[14]
}}A. Jacobson. HAppS-State: Event-based distributed state, 2009. hackageDB: HAppS-State.
[15]
}}P. Jansson and J. Jeuring. Polytypic data conversion programs. Science of Computer Programming, 43:2002, 2001.
[16]
}}P. Jansson and J. Jeuring. PolyP - a polytypic programming language extension. In Principles of Programming Languages, pages 470--482. ACM, 1997.
[17]
}}P. Johann. Foundations for structured programming with GADTs. In Principles of Programming Languages, pages 297--308, 2008.
[18]
}}O. Kiselyov. iteratee: Iteratee-based I/O, 2009. hackageDB: iteratee.
[19]
}}L. Kolmodin and D. Stewart. binary: Binary serialisation for Haskell values using lazy ByteStrings, 2009. hackageDB: binary.
[20]
}}L. Meertens. Paramorphisms. Formal Aspects of Computing, 4(5): 413--424, September 1992.
[21]
}}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.
[22]
}}J. Nievergelt and E. M. Reingold. Binary search trees of bounded balance. In ACM symposium on Theory of computing, pages 137--142. ACM, 1972.
[23]
}}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.
[24]
}}T. Sheard. Generic unification via two-level types and parameterized modules. In International Conference on Functional Programming, pages 86--97. ACM, 2001.
[25]
}}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.
[26]
}}W. Swierstra. Data types à la carte. Journal of Functional Programming, 18(4):423--436, 2008.
[27]
}}T. Uustalu and V. Vene. Primitive (co)recursion and course-of-value (co)iteration, categorically. Informatica, 10:5--26, 1999.
[28]
}}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.
[29]
}}M. van Steenbergen, J. P. Magalhães, and J. Jeuring. Generic selections of subexpressions. In Workshop on Generic Programming. ACM, 2010.
[30]
}}V. Vene and T. Uustalu. Functional programming with apomorphisms (corecursion). In Nordic Workshop on Programming Theory, 1998.
[31]
}}S. Visser. A generic approach to datatype persistency in Haskell. Master's thesis, Utrecht University, 2010. URL http://github.com/sebastiaanvisser/msc-thesis/downloads.

Cited By

View all
  • (2013)Generic representations of tree transformationsProceedings of the 9th ACM SIGPLAN workshop on Generic programming10.1145/2502488.2502490(73-84)Online publication date: 28-Sep-2013
  • (2011)Compositional data typesProceedings of the seventh ACM SIGPLAN workshop on Generic programming10.1145/2036918.2036930(83-94)Online publication date: 18-Sep-2011
  • (2010)Generic selections of subexpressionsProceedings of the 6th ACM SIGPLAN workshop on Generic programming10.1145/1863495.1863501(37-48)Online publication date: 26-Sep-2010

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
WGP '10: Proceedings of the 6th ACM SIGPLAN workshop on Generic programming
September 2010
116 pages
ISBN:9781450302517
DOI:10.1145/1863495
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 26 September 2010

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. annotations
  2. datatype-generic programming
  3. fixed points

Qualifiers

  • Research-article

Conference

ICFP '10
Sponsor:

Acceptance Rates

Overall Acceptance Rate 30 of 43 submissions, 70%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)1
  • Downloads (Last 6 weeks)0
Reflects downloads up to 05 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2013)Generic representations of tree transformationsProceedings of the 9th ACM SIGPLAN workshop on Generic programming10.1145/2502488.2502490(73-84)Online publication date: 28-Sep-2013
  • (2011)Compositional data typesProceedings of the seventh ACM SIGPLAN workshop on Generic programming10.1145/2036918.2036930(83-94)Online publication date: 18-Sep-2011
  • (2010)Generic selections of subexpressionsProceedings of the 6th ACM SIGPLAN workshop on Generic programming10.1145/1863495.1863501(37-48)Online publication date: 26-Sep-2010

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media