Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/2364527.2364541acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Functional programming with structured graphs

Published: 09 September 2012 Publication History

Abstract

This paper presents a new functional programming model for graph structures called structured graphs. Structured graphs extend conventional algebraic datatypes with explicit definition and manipulation of cycles and/or sharing, and offer a practical and convenient way to program graphs in functional programming languages like Haskell. The representation of sharing and cycles (edges) employs recursive binders and uses an encoding inspired by parametric higher-order abstract syntax. Unlike traditional approaches based on mutable references or node/edge lists, well-formedness of the graph structure is ensured statically and reasoning can be done with standard functional programming techniques. Since the binding structure is generic, we can define many useful generic combinators for manipulating structured graphs. We give applications and show how to reason about structured graphs.

References

[1]
M. Abbott, T. Altenkirch, C. McBride, and N. Ghani. δ for data: Differentiating data structures. Fundam. Inf., 65:1--28, 2004.
[2]
A. V. Aho, R. Sethi, and J. D. Ullman. Compilers: Principles, Techniques and Tools. Addison-Wesley, 1988.
[3]
R. Atkey. Syntax for free: Representing syntax with binding using parametricity. In TLCA'09, 2009.
[4]
A. Baars, S. Doaitse Swierstra, and M. Viera. Typed transformations of typed grammars: The left corner transform. Electron. Notes Theor. Comput. Sci., 253(7), 2010.
[5]
R. Bird and R. Paterson. Generalised folds for nested datatypes. Formal Aspects of Computing, 11:11--2, 1999.
[6]
R. S. Bird and L. G. L. T. Meertens. Nested datatypes. In MPC '98, 1998.
[7]
J. A. Brzozowski. Derivatives of regular expressions. J. ACM, 11, 1964.
[8]
P. P. Chen. The entity-relationship model - toward a unified view of data. ACM Trans. Database Syst., 1(1):9--36, 1976.
[9]
A. Chlipala. Parametric higher-order abstract syntax for mechanized semantics. In ICFP'08, 2008.
[10]
N. A. Danielsson. Total parser combinators. In ICFP'10, 2010.
[11]
J. Despeyroux, A. Felty, and A. Hirschowitz. Higher-order abstract syntax in Coq. In TLCA'95, 1995.
[12]
D. Devriese and F. Piessens. Explicitly recursive grammar combinators - a better model for shallow parser DSLs. In PADL 2011, 2011.
[13]
M. Erwig. Inductive graphs and functional graph algorithms. J. Funct. Program., 11, 2001.
[14]
L. Fegaras and T. Sheard. Revisiting catamorphisms over datatypes with embedded functions (or, programs from outer space). In POPL'96, 1996.
[15]
N. Ghani, M. Hamana, T. Uustalu, and V Vene. Representing cyclic structures as nested datatypes. In TFP'06, 2006.
[16]
J. Gibbons. An initial-algebra approach to directed acyclic graphs. In MPC '95, 1995.
[17]
J. Gibbons. Datatype-generic programming. In Spring School on Datatype-Generic Programming, volume 4719 of Lecture Notes in Computer Science. Springer-Verlag, 2007.
[18]
J. Gibbons and B. C. d. S. Oliveira. The essence of the iterator pattern. J. Funct. Program., 19(3-4), 2009.
[19]
A. Gill. Type-safe observable sharing in Haskell. In Haskell'09, 2009.
[20]
M. Hamana. Initial algebra semantics for cyclic sharing tree structures. Logical Methods in Computer Science, 6(3), 2010.
[21]
F. Honsell, M. Miculan, and I. Scagnetto. An axiomatic approach to metareasoning on nominal algebras in hoas. In ICALP '01, 2001.
[22]
J. Hughes. Lazy memo-functions. In FPCA'85, 1985.
[23]
P. Jansson and J. Jeuring. Polyp - a polytypic programming language extension. In POPL'97, 1997.
[24]
X. Leroy, D. Doligez, A. Frisch, J. Garrigue, D. Rémy, and J. Vouillon. The OCaml system (release 3.12): Documentation and user's manual. Institut National de Recherche en Informatique et en Automatique, 2011.
[25]
C.Martin, J. Gibbons, and I. Bayley. Disciplined, efficient, generalised folds for nested datatypes. Form. Asp. Comput., 16, 2004.
[26]
C. Mcbride and R. Paterson. Applicative programming with effects. J. Funct. Program., 18(1), 2008.
[27]
E. Meijer and G. Hutton. Bananas in space: extending fold and unfold to exponential types. In FPCA'95, 1995.
[28]
M. Might, D. Darais, and D. Spiewak. Parsing with derivatives: a functional pearl. In ICFP '11, 2011.
[29]
R. Milner, M. Tofte, R. Harper, and D. Macqueen. The Definition of Standard ML - Revised. The MIT Press, 1997.
[30]
B. C. d. S. Oliveira and Andres Löh. Abstract syntax graphs for domain specific languages. Unpublished. Manuscript available at http://ropas.snu.ac.kr/~bruno/papers/ASGDSL.pdf, 2012.
[31]
S. Peyton Jones et al. The Haskell 98 language and libraries: The revised report. Journal of Functional Programming, 13(1):0--255, 2003.
[32]
S. Peyton Jones, D. Vytiniotis, S. Weirich, and M. Shields. Practical type inference for arbitrary-rank types. J. Funct. Program., 17:1--82, 2007.
[33]
S. Peyton Jones, D. Vytiniotis, S. Weirich, and G. Washburn. Simple unification-based type inference for GADTs. In ICFP'06, 2006.
[34]
F. Pfenning and C. Elliot. Higher-order abstract syntax. In PLDI '88, 1988.
[35]
F. Pottier. Lazy least fixed points in ML. Unpublished. Manuscript available at http://gallium.inria.fr/~fpottier/publis/fpottier-fix.pdf, 2009.
[36]
J. C. Reynolds. Types, abstraction and parametric polymorphism. In IFIP Congress, pages 513--523, 1983.
[37]
P. Wadler. Theorems for free! In FPCA '89, 1989.
[38]
P. Wadler. The essence of functional programming. In POPL'92, 1992.
[39]
G. Washburn and S. Weirich. Boxes go bananas: Encoding higher-order abstract syntax with parametric polymorphism. Journal of Functional Programming, 18:87--140, 2008.

Cited By

View all
  • (2024)Beyond Trees: Calculating Graph-Based Compilers (Functional Pearl)Proceedings of the ACM on Programming Languages10.1145/36746388:ICFP(370-394)Online publication date: 15-Aug-2024
  • (2023)Ideograph: A Language for Expressing and Manipulating Structured DataElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.377.4377(65-84)Online publication date: 1-Apr-2023
  • (2022)Fregel: a functional domain-specific language for vertex-centric large-scale graph processingJournal of Functional Programming10.1017/S095679682100027732Online publication date: 20-Jan-2022
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICFP '12: Proceedings of the 17th ACM SIGPLAN international conference on Functional programming
September 2012
392 pages
ISBN:9781450310543
DOI:10.1145/2364527
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 47, Issue 9
    ICFP '12
    September 2012
    368 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2398856
    Issue’s Table of Contents
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: 09 September 2012

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. graphs
  2. haskell
  3. parametric hoas

Qualifiers

  • Research-article

Conference

ICFP'12
Sponsor:

Acceptance Rates

ICFP '12 Paper Acceptance Rate 32 of 88 submissions, 36%;
Overall Acceptance Rate 333 of 1,064 submissions, 31%

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)13
  • Downloads (Last 6 weeks)4
Reflects downloads up to 15 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Beyond Trees: Calculating Graph-Based Compilers (Functional Pearl)Proceedings of the ACM on Programming Languages10.1145/36746388:ICFP(370-394)Online publication date: 15-Aug-2024
  • (2023)Ideograph: A Language for Expressing and Manipulating Structured DataElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.377.4377(65-84)Online publication date: 1-Apr-2023
  • (2022)Fregel: a functional domain-specific language for vertex-centric large-scale graph processingJournal of Functional Programming10.1017/S095679682100027732Online publication date: 20-Jan-2022
  • (2022)Folding over Neural NetworksMathematics of Program Construction10.1007/978-3-031-16912-0_5(129-150)Online publication date: 22-Sep-2022
  • (2017)A functional reformulation of UnCAL graph-transformations: or, graph transformation as graph reductionProceedings of the 2017 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation10.1145/3018882.3018883(71-82)Online publication date: 2-Jan-2017
  • (2016)Lazy graph processing in HaskellACM SIGPLAN Notices10.1145/3241625.297601451:12(182-192)Online publication date: 8-Sep-2016
  • (2016)The Key monad: type-safe unconstrained dynamic typingACM SIGPLAN Notices10.1145/3241625.297600851:12(146-157)Online publication date: 8-Sep-2016
  • (2016)Think like a vertex, behave like a function! a functional DSL for vertex-centric big graph processingACM SIGPLAN Notices10.1145/3022670.295193851:9(200-213)Online publication date: 4-Sep-2016
  • (2016)Lazy graph processing in HaskellProceedings of the 9th International Symposium on Haskell10.1145/2976002.2976014(182-192)Online publication date: 8-Sep-2016
  • (2016)The Key monad: type-safe unconstrained dynamic typingProceedings of the 9th International Symposium on Haskell10.1145/2976002.2976008(146-157)Online publication date: 8-Sep-2016
  • Show More Cited By

View Options

Get Access

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media