skip to main content
research-article

Guarded impredicative polymorphism

Published:11 June 2018Publication History
Skip Abstract Section

Abstract

The design space for type systems that support impredicative instantiation is extremely complicated. One needs to strike a balance between expressiveness, simplicity for both the end programmer and the type system implementor, and how easily the system can be integrated with other advanced type system concepts. In this paper, we propose a new point in the design space, which we call guarded impredicativity. Its key idea is that impredicative instantiation in an application is allowed for type variables that occur under a type constructor. The resulting type system has a clean declarative specification — making it easy for programmers to predict what will type and what will not —, allows for a smooth integration with GHC’s OutsideIn(X) constraint solving framework, while giving up very little in terms of expressiveness compared to systems like HMF, HML, FPH and MLF. We give a sound and complete inference algorithm, and prove a principal type property for our system.

Skip Supplemental Material Section

Supplemental Material

p783-serrano.webm

References

  1. Didier Le Botlan and Didier Rémy. 2003. MLF: raising ML to the power of system F. In Proceedings of the Eighth ACM SIGPLAN International Conference on Functional Programming, ICFP 2003, Uppsala, Sweden, August 25-29, 2003, Colin Runciman and Olin Shivers (Eds.). ACM, 27-38. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Didier Le Botlan and Didier Rémy. 2009. Recasting MLF. Inf. Comput. 207, 6 (2009), 726-785. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Hubert Comon and Pierre Lescanne. 1988. Equational problems and disunification. Research Report RR-0904. INRIA. https://hal.inria.fr/inria-00075652Google ScholarGoogle Scholar
  4. Joshua Dunfield and Neelakantan R. Krishnaswami. 2013. Complete and easy bidirectional typechecking for higher-rank polymorphism. In ACM SIGPLAN International Conference on Functional Programming, ICFP'13, Boston, MA, USA - September 25 - 27, 2013, Greg Morrisett and Tarmo Uustalu (Eds.). ACM, 429-442. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Richard A. Eisenberg, Stephanie Weirich, and Hamidhasan G. Ahmed. 2016. Visible Type Application. In Proceedings of the 25th European Symposium on Programming Languages and Systems - Volume 9632. Springer-Verlag New York, Inc., New York, NY, USA, 229-254. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Bastiaan Heeren, Jurriaan Hage, and S. Doaitse Swierstra. 2003. Scripting the type inference process. SIGPLAN Notices 38, 9 (2003), 3-13. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. James Hook and Peter Thiemann (Eds.). 2008. Proceeding of the 13th ACM SIGPLAN international conference on Functional programming, ICFP 2008, Victoria, BC, Canada, September 20-28, 2008. ACM. Google ScholarGoogle ScholarCross RefCross Ref
  8. Daan Leijen. 2008. HMF: simple type inference for first-class polymorphism, See [7], 283-294. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Daan Leijen. 2009. Flexible types: robust type inference for first-class polymorphism. In Proceedings of the 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2009, Savannah, GA, USA, January 21-23, 2009, Zhong Shao and Benjamin C. Pierce (Eds.). ACM, 66-77. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Daan Leijen and Andres Löh. 2005. Qualified types for MLF. In Proceedings of the 10th ACM SIGPLAN International Conference on Functional Programming, ICFP 2005, Tallinn, Estonia, September 26-28, 2005, Olivier Danvy and Benjamin C. Pierce (Eds.). ACM, 144-155. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. J. W. O'Toole, Jr. and D. K. Gifford. 1989. Type Reconstruction with First-class Polymorphic Values. In Proceedings of the ACM SIGPLAN 1989 Conference on Programming Language Design and Implementation (PLDI '89). ACM, New York, NY, USA, 207-217. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Simon L. Peyton Jones, Dimitrios Vytiniotis, Stephanie Weirich, and Mark Shields. 2007. Practical type inference for arbitrary-rank types. Journal of Functional Programming 17, 1 (2007), 1-82. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Frank Pfenning. 1988. Partial Polymorphic Type Inference and Higher-order Unification. In Proceedings of the 1988 ACM Conference on LISP and Functional Programming (LFP '88). ACM, New York, NY, USA, 153-163. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. François Pottier and Didier Rémy. 2005. The Essence of ML Type Inference. In Advanced Topics in Types and Programming Languages, Benjamin C. Pierce (Ed.). MIT Press, Chapter 10, 389-489. http://cristal.inria.fr/attapl/Google ScholarGoogle Scholar
  15. Didier Rémy. 1994. Programming Objects with ML-ART, an Extension to ML with Abstract and Record Types. In Proceedings of the International Conference on Theoretical Aspects of Computer Software (TACS '94). Springer-Verlag, London, UK, UK, 321-346. http://dl.acm.org/citation.cfm?id=645868.668492 Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Didier Rémy. 2005. Simple, Partial Type-inference for System F Based on Type-containment. In Proceedings of the Tenth ACM SIGPLAN International Conference on Functional Programming (ICFP '05). ACM, New York, NY, USA, 130-143. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Didier Rémy and Boris Yakobowski. 2008. From ML to MLF: graphic type constraints with efficient type inference, See [7], 63-74. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Claudio V. Russo and Dimitrios Vytiniotis. 2009. QML: Explicit Firstclass Polymorphism for ML. In Proceedings of the 2009 ACM SIGPLAN Workshop on ML (ML '09). ACM, New York, NY, USA, 3-14. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Alejandro Serrano and Jurriaan Hage. 2016. Type Error Diagnosis for Embedded DSLs by Two-Stage Specialized Type Rules. In Programming Languages and Systems - 25th European Symposium on Programming, ESOP 2016, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2016, Eindhoven, The Netherlands, April 2-8, 2016, Proceedings (Lecture Notes in Computer Science), Peter Thiemann (Ed.), Vol. 9632. Springer, 672-698. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Dimitrios Vytiniotis, Simon L. Peyton Jones, Tom Schrijvers, and Martin Sulzmann. 2011. OutsideIn(X): Modular type inference with local assumptions. J. Funct. Program. 21, 4-5 (2011), 333-412. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Dimitrios Vytiniotis, Stephanie Weirich, and Simon L. Peyton Jones. 2006. Boxy types: inference for higher-rank types and impredicativity. In Proceedings of the 11th ACM SIGPLAN International Conference on Functional Programming, ICFP 2006, Portland, Oregon, USA, September 16-21, 2006, John H. Reppy and Julia L. Lawall (Eds.). ACM, 251-262. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Dimitrios Vytiniotis, Stephanie Weirich, and Simon L. Peyton Jones. 2008. FPH: first-class polymorphism for Haskell, See [7], 295-306. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. J. B. Wells. 1993. Typability and Type Checking in the Second-Order Lambda-Calculus Are Equivalent and Undecidable. Technical Report. Boston, MA, USA. Google ScholarGoogle Scholar
  24. Danfeng Zhang, Andrew C. Myers, Dimitrios Vytiniotis, and Simon L. Peyton Jones. 2015. Diagnosing type errors with class. In Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation, Portland, OR, USA, June 15-17, 2015, David Grove and Steve Blackburn (Eds.). ACM, 12-21. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Guarded impredicative polymorphism

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 53, Issue 4
      PLDI '18
      April 2018
      834 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/3296979
      Issue’s Table of Contents
      • cover image ACM Conferences
        PLDI 2018: Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation
        June 2018
        825 pages
        ISBN:9781450356985
        DOI:10.1145/3192366

      Copyright © 2018 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 11 June 2018

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!