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

A foundation for GADTs and inductive families: dependent polynomial functor approach

Published: 18 September 2011 Publication History

Abstract

Every Algebraic Datatype (ADT) is characterised as the initial algebra of a polynomial functor on sets. This paper extends the characterisation to the case of more advanced datatypes: Generalised Algebraic Datatypes (GADTs) and Inductive Families. Specifically, we show that GADTs and Inductive Families are characterised as initial algebras of dependent polynomial functors. The theoretical tool we use throughout is an abstract notion of polynomial between sets together with its associated general form of polynomial functor between categories of indexed sets introduced by Gambino and Hyland.
In the context of ADTs, this fundamental result is the basis for various generic functional programming techniques. To establish the usefulness of our approach for such developments in the broader context of inductively defined dependent types, we apply the theory to construct zippers for Inductive Families.

Supplementary Material

JPG File (_talk6.jpg)
MP4 File (_talk6.mp4)

References

[1]
M. Abbott, T. Altenkirch, and N. Ghani. Representing nested inductive types using W-types. In ICALP'04, pages 59--71, 2004.
[2]
M. Abbott, T. Altenkirch, C. McBride, and N. Ghani. \partial for data: Differentiating data structures. Fundam. Inform., 65 (1-2): 1--28, 2005.
[3]
A. Abel, R. Matthes, and T. Uustalu. Iteration and coiteration schemes for higher-order and nested datatypes. Theor. Comput. Sci., 333 (1-2): 3--66, 2005.
[4]
J. Adamek. Free algebras and automata realizations in the language of categories. Comment. Math. Univ. Carolina, 15 (589602), 1974.
[5]
M. D. Adams. Scrap your zippers: A generic zipper for heterogeneous types. In WGP '10, pages 13--24. ACM, 2010.
[6]
T. Altenkirch and C. McBride. Generic programming within dependently typed programming. In Generic Programming, pages 1--20, 2002.
[7]
T. Altenkirch and P. Morris. Indexed containers. In LICS'09, pages 277--285, 2009.
[8]
M. Benke, P. Dybjer, and P. Jansson. Universes for generic programs and proofs in dependent type theory. Nord. J. Comput., 10 (4): 265--289, 2003.
[9]
R. Bird and R. Paterson. Generalised folds for nested datatypes. Form. Asp. of Comput., 11 (2): 200--222, 1999.
[10]
R. Bird and R. Paterson. De Bruijn notation as a nested datatype. J. of Funct. Program., 9 (1): 77--91, 1999.
[11]
A. Bove and P. Dybjer. Dependent types at work. In LerNet ALFA Summer School, pages 57--99, 2008.
[12]
J. Chapman, P. Dagand, C. McBride, and P. Morris. The gentle art of levitation. In Proc. of ICFP'10, pages 3--14, 2010.
[13]
N. A. Danielsson, J. Hughes, P. Jansson, and J. Gibbons. Fast and loose reasoning is morally correct. In Proc. of POPL'06, pages 206--217, 2006.
[14]
P. Dybjer. Inductive families. Formal Aspects of Computing, 6: 440--465, 1994.
[15]
P. Dybjer and A. Setzer. Indexed induction-recursion. J. Log. Algebr. Program., 66 (1): 1--49, 2006.
[16]
P. Dybjer and A. Setzer. Induction-recursion and initial algebras. Ann. Pure Appl. Logic, 124 (1-3): 1--47, 2003.
[17]
M. Fiore. Mathematical models of computational and combinatorial structures. In Proc. FOSSACS 2005, LNCS 3441, pages 25--46, 2005.
[18]
M. Fiore, G. Plotkin, and D. Turi. Abstract syntax and variable binding. In Proc. of 14th Annual Symposium on Logic in Computer Science, pages 193--202, 1999.
[19]
N. Gambino and M. Hyland. Wellfounded trees and dependent polynomial functors. In TYPES'03, pages 210--225, 2003.
[20]
N. Gambino and J. Kock. Polynomial functors and polynomial monads. ArXiv:0906.4931, 2010.
[21]
N. Ghani, P. Johann, T. Uustalu, and V. Vene. Monadic augment and generalised short cut fusion. In Proc. of ICFP'05, pages 294--305, 2005.
[22]
T. Hagino. A typed lambda calculus with categorical type constructors. In Pitt et al., editor, Category Theory in Computer Science'87, LNCS 283, pages 140--157. Springer-Verlag, 1987.
[23]
R. Hinze. Fun with phantom types. In The Fun of Programming, pages 245--262. Palgrave Macmillan, 2003.
[24]
R. Hinze. Adjoint folds and unfolds. In Proc. of MPC'10, pages 195--228, 2010.
[25]
R. Hinze and J. Jeuring. Generic Haskell: Practice and theory. In Generic Programming, LNCS 2793, pages 1--56, 2003.
[26]
Z. Hu, H. Iwasaki, and M. Takeichi. Deriving structural hylomorphisms from recursive definitions. In Proc. of ICFP'96, pages 73--82, 1996.
[27]
G. Huet. Functional pearl: The zipper. Journal of Functional Programming, 6 (5): 549--554, 1997.
[28]
B. Jacobs. Categorical Logic and Type Theory. Studies in Logic and the Foundations of Mathematics 141. North Holland, Elsevier, 1999.
[29]
P. Jansson and J. Jeuring. Polyp - a polytypic programming language. In POPL, pages 470--482, 1997.
[30]
P. Johann and N. Ghani. Foundations for structured programming with GADTs. In Proc. of POPL'08, pages 297--308, 2008.
[31]
S. Katsumata and S. Nishimura. Algebraic fusion of functions with an accumulating parameter and its improvement. J. Funct. Program., 18 (5-6): 781--819, 2008.
[32]
J. Kock. Notes on polynomial functors. Manuscript, version 2009-08-05, 2009.
[33]
J. Launchbury and T. Sheard. Warm fusion: Deriving build-cata's from recursive definitions. In Proc. of FPCA'95, pages 314--323, 1995.
[34]
F.W. Lawvere. Adjointness in foundations. Dialectica, pages 281--296, 1969.
[35]
S. Mac Lane. Categories for the Working Mathematician, volume 5 of Graduate Texts in Mathematics. Springer-Verlag, 1971.
[36]
S. Mac Lane and I. Moerdijk. Sheaves in Geometry and Logic: A First Introduction to Topos Theory. Springer-Verlag, 1994.
[37]
C. McBride. Epigram: Practical programming with dependent types. In Advanced Functional Programming, pages 130--170, 2004.
[38]
C. McBride. The derivative of a regular type is its type of one-hole contexts. Manuscript, 2001.
[39]
C. McBride. Dependently Typed Programs and their Proofs. PhD thesis, University of Edinburgh, 1999.
[40]
E. Meijer, M. M. Fokkinga, and R. Paterson. Functional programming with bananas, lenses, envelopes and barbed wire. In Proc of FPCA'91, pages 124--144, 1991.
[41]
A. Morihata, K. Matsuzaki, Z. Hu, and M. Takeichi. The third homomorphism theorem on trees: downward & upward lead to divide-and-conquer. In POPL'09, pages 177--185, 2009.
[42]
U. Norell. Towards a practical programming language based on dependent type theory. PhD thesis, Chalmers University of Technology, 2007.
[43]
U. Norell. Dependently typed programming in Agda. In Advanced Functional Programming, pages 230--266, 2008.
[44]
N. Oury and W. Swierstra. The power of Pi. In Proc. of ICFP'08, pages 39--50, 2008.
[45]
T. Schrijvers, S. L. Peyton Jones, M. Sulzmann, and D. Vytiniotis. Complete and decidable type inference for GADTs. In ICFP'09, pages 341--352, 2009.
[46]
T. Sheard and L. Fegaras. A fold for all seasons. In Proc. of FPCA'93, pages 233--242, 1993.
[47]
M. B. Smyth and G. D. Plotkin. The category-theoretic solution of recursive domain equations. SIAM J. Comput, 11 (4): 763--783, 1982.
[48]
A. Takano and E. Meijer. Shortcut deforestation in calculational form. In Proc. of FPCA'95, pages 306--313, 1995.
[49]
N. Yoneda. On Ext and exact sequences. Jour. Fac. Sci. Univ. Tokyo, pages 507--576, 1960.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
WGP '11: Proceedings of the seventh ACM SIGPLAN workshop on Generic programming
September 2011
102 pages
ISBN:9781450308618
DOI:10.1145/2036918
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: 18 September 2011

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. categorical semantics
  2. dependent types

Qualifiers

  • Research-article

Conference

ICFP '11
Sponsor:

Acceptance Rates

WGP '11 Paper Acceptance Rate 8 of 10 submissions, 80%;
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)7
  • Downloads (Last 6 weeks)1
Reflects downloads up to 05 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2024)GADTs are not (Even partial) functorsMathematical Structures in Computer Science10.1017/S0960129524000161(1-24)Online publication date: 27-Aug-2024
  • (2022)GADTs, Functoriality, Parametricity: Pick TwoElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.357.6357(77-92)Online publication date: 7-Apr-2022
  • (2022)Categorical Data Structures for Technical ComputingCompositionality10.32408/compositionality-4-54(5)Online publication date: 28-Dec-2022
  • (2022)Implementing a category-theoretic framework for typed abstract syntaxProceedings of the 11th ACM SIGPLAN International Conference on Certified Programs and Proofs10.1145/3497775.3503678(307-323)Online publication date: 17-Jan-2022
  • (2022)Characterizing Functions Mappable over GADTsProgramming Languages and Systems10.1007/978-3-031-21037-2_7(135-154)Online publication date: 25-Nov-2022
  • (2019)Higher-kinded data typesProceedings of the 34th Annual ACM/IEEE Symposium on Logic in Computer Science10.5555/3470152.3470155(1-13)Online publication date: 24-Jun-2019
  • (2018)Compositional soundness proofs of abstract interpretersProceedings of the ACM on Programming Languages10.1145/32367672:ICFP(1-26)Online publication date: 30-Jul-2018
  • (2016)Type Theory based on Dependent Inductive and Coinductive TypesProceedings of the 31st Annual ACM/IEEE Symposium on Logic in Computer Science10.1145/2933575.2934514(327-336)Online publication date: 5-Jul-2016
  • (2013)A Categorical Treatment of OrnamentsProceedings of the 2013 28th Annual ACM/IEEE Symposium on Logic in Computer Science10.5555/2591370.2591396(530-539)Online publication date: 25-Jun-2013
  • (2013)A Categorical Treatment of Ornaments2013 28th Annual ACM/IEEE Symposium on Logic in Computer Science10.1109/LICS.2013.60(530-539)Online publication date: Jun-2013

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