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

Complete and decidable type inference for GADTs

Published: 31 August 2009 Publication History

Abstract

GADTs have proven to be an invaluable language extension, for ensuring data invariants and program correctness among others. Unfortunately, they pose a tough problem for type inference: we lose the principal-type property, which is necessary for modular type inference.
We present a novel and simplified type inference approach for local type assumptions from GADT pattern matches. Our approach is complete and decidable, while more liberal than previous such approaches.

Supplementary Material

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

References

[1]
J. Cheney and R. Hinze. First-class phantom types. TR 1901, Cornell University, 2003.
[2]
A. Degtyarev and A. Voronkov. Simultaneous regid E-unification is undecidable. In Proc. of CSL'95, volume 1092 of LNCS, pages 178--190. Springer, 1995.
[3]
J. H. Gallier, P. Narendran, S. Raatz, and W. Snyder. Theorem proving using equational matings and rigid e-unification. J. ACM, 39(2):377--429, 1992.
[4]
J. R. Lewis, J. Launchbury, E. Meijer, and M. Shields. Implicit parameters: Dynamic scoping with static types. In POPL, pages 108--118, 2000.
[5]
M. Maher. Herbrand constraint abduction. In Proc. of LICS'05, pages 397--406. IEEE Comp. Soc., 2005.
[6]
F. Pottier and D. Rémy. The essence of ML type inference. In Benjamin C. Pierce, editor, Advanced Topics in Types and Programming Languages, chapter 10, pages 389--489. MIT Press, 2005.
[7]
F. Pottier and Y. Régis-Gianas. Stratified type inference for generalized algebraic data types. In Proc. of POPL'06, pages 232--244. ACM, 2006.
[8]
S. Peyton Jones, D. Vytiniotis, S. Weirich, and M. Shields. Practical type inference for arbitrary-rank types. J. of Func. Prog., 17:1--82, January 2007.
[9]
S. Peyton Jones, D. Vytiniotis, S. Weirich, and G. Washburn. Simple unification-based type inference for GADTs. In Proc. of ICFP'06, pages 50--61. ACM, 2006.
[10]
M. Sulzmann, M. Chakravarty, S. Peyton Jones, and K. Donnelly. System F with type equality coercions. In Proc. of TLDI'07. ACM, 2007.
[11]
T. Schrijvers, S. Peyton Jones, M. Chakravarty, and M. Sulzmann. Type checking with open type functions. SIGPLAN Not., 43(9):51--62, 2008.
[12]
V. Simonet and F. Pottier. A constraint-based approach to guarded algebraic data types. ACM Trans. Prog. Languages Systems, 29(1), January 2007.
[13]
M. Sulzmann, T. Schrijvers, and P. J. Stuckey. Principal type inference for GHC-style multi-parameter type classes. In Proc. of APLAS'06, volume 4279 of LNCS, pages 26--43. Springer, 2006.
[14]
M. Sulzmann, T. Schrijvers, and P. Stuckey. Type inference for GADTs via Herbrand constraint abduction. Report CW 507, K.U.Leuven, Belgium, 2008.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICFP '09: Proceedings of the 14th ACM SIGPLAN international conference on Functional programming
August 2009
364 pages
ISBN:9781605583327
DOI:10.1145/1596550
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 44, Issue 9
    ICFP '09
    September 2009
    343 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/1631687
    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: 31 August 2009

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. GADTs
  2. Haskell
  3. type inference

Qualifiers

  • Research-article

Conference

ICFP '09
Sponsor:
ICFP '09: ACM SIGPLAN International Conference on Functional Programming
August 31 - September 2, 2009
Edinburgh, Scotland

Acceptance Rates

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)16
  • Downloads (Last 6 weeks)4
Reflects downloads up to 13 Jan 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)Partial type constructors in practiceProceedings of the 15th ACM SIGPLAN International Haskell Symposium10.1145/3546189.3549923(95-107)Online publication date: 6-Sep-2022
  • (2021)Dynamic Editors for Well-Typed ExpressionsTrends in Functional Programming10.1007/978-3-030-83978-9_3(44-66)Online publication date: 23-Aug-2021
  • (2019)Kind inference for datatypesProceedings of the ACM on Programming Languages10.1145/33711214:POPL(1-28)Online publication date: 20-Dec-2019
  • (2019)Partial type constructors: or, making ad hoc datatypes less ad hocProceedings of the ACM on Programming Languages10.1145/33711084:POPL(1-28)Online publication date: 20-Dec-2019
  • (2019)Constraint-based type-directed program synthesisProceedings of the 4th ACM SIGPLAN International Workshop on Type-Driven Development10.1145/3331554.3342608(64-76)Online publication date: 18-Aug-2019
  • (2018)Type variables in patternsACM SIGPLAN Notices10.1145/3299711.324275353:7(94-105)Online publication date: 17-Sep-2018
  • (2018)Type variables in patternsProceedings of the 11th ACM SIGPLAN International Symposium on Haskell10.1145/3242744.3242753(94-105)Online publication date: 17-Sep-2018
  • (2018)Ghostbuster: A tool for simplifying and converting GADTsJournal of Functional Programming10.1017/S095679681800011428Online publication date: 22-Jun-2018
  • (2018)Dualizing Generalized Algebraic Data Types by Matrix TranspositionProgramming Languages and Systems10.1007/978-3-319-89884-1_3(60-85)Online publication date: 14-Apr-2018
  • Show More Cited By

View Options

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