Abstract
Bidirectional typing combines two modes of typing: type checking, which checks that a program satisfies a known type, and type synthesis, which determines a type from the program. Using checking enables bidirectional typing to support features for which inference is undecidable; using synthesis enables bidirectional typing to avoid the large annotation burden of explicitly typed languages. In addition, bidirectional typing improves error locality. We highlight the design principles that underlie bidirectional type systems, survey the development of bidirectional typing from the prehistoric period before Pierce and Turner’s local type inference to the present day, and provide guidance for future investigations.
- João Alpuim, Bruno C. d. S. Oliveira, and Zhiyuan Shi. 2017. Disjoint polymorphism. In Proceedings of the European Symposium on Programming. Springer, 1--28.Google ScholarDigital Library
- Thorsten Altenkirch, Nils Anders Danielsson, Andres Löh, and N. Oury. 2010. ΠΣ: Dependent types without the sugar. In Proceedings of the International Symposium on Functional and Logic Programming (FLOPS’10). Springer, 40--55.Google Scholar
- Henk Barendregt, Mario Coppo, and Mariangiola Dezani-Ciancaglini. 1983. A filter lambda model and the completeness of type assignment. J. Symbol. Logic 48, 4 (1983), 931--940.Google ScholarCross Ref
- Luca Cardelli. 1993. An Implementation of . Research report 97. DEC/Compaq Systems Research Center.Google Scholar
- Ezgi Çiçek, Weihao Qu, Gilles Barthe, Marco Gaboardi, and Deepak Garg. 2019. Bidirectional type checking for relational properties. In Proceedings of the Conference on Programming Language Design and Implementation (PLDI’19). ACM Press, 533--547.Google Scholar
- Iliano Cervesato and Frank Pfenning. 2003. A linear spine calculus. J. Logic Comput. 13, 5 (2003), 639--688.Google ScholarCross Ref
- Adam Chlipala, Leaf Petersen, and Robert Harper. 2005. Strict bidirectional type checking. In Proceedings of the Workshop on Types in Language Design and Implementation (TLDI ’05). ACM Press, 71--78.Google ScholarDigital Library
- Thierry Coquand. 1996. An algorithm for type-checking dependent types. Sci. Comput. Program. 26, 1--3 (1996), 167--177.Google ScholarDigital Library
- Luis Damas and Robin Milner. 1982. Principal type-schemes for functional programs. In Proceedings of the Symposium on Principles of Programming Languages (POPL’82). ACM, 207--212.Google ScholarDigital Library
- Rowan Davies. 2005. Practical Refinement-Type Checking. Ph.D. Dissertation. Carnegie Mellon University. CMU-CS-05-110.Google ScholarDigital Library
- Rowan Davies and Frank Pfenning. 2000. Intersection types and computational effects. In Proceedings of the International Conference on Functional Programming (ICFP’00). ACM Press, 198--208.Google ScholarDigital Library
- Stephen Dolan. 2016. Algebraic Subtyping. Ph.D. Dissertation. University of Cambridge.Google Scholar
- Jana Dunfield. 2007. A Unified System of Type Refinements. Ph.D. Dissertation. Carnegie Mellon University. CMU-CS-07-129.Google Scholar
- Jana Dunfield. 2009. Greedy bidirectional polymorphism. In Proceedings of the Machine Learning Workshop (ML’09). ACM Press, 15--26. Retrieved from http://research.cs.queensu.ca/~jana/papers/poly/.Google ScholarDigital Library
- Jana Dunfield. 2012. Elaborating intersection and union types. In Proceedings of the International Conference on Functional Programming (ICFP’12). ACM Press, 17--28.Google ScholarDigital Library
- Jana Dunfield. 2014. Elaborating intersection and union types. J. Functional Programming 24, 2--3 (2014), 133--165.Google ScholarCross Ref
- Jana Dunfield. 2015. Elaborating evaluation-order polymorphism. In Proceedings of the International Conference on Functional Programming (ICFP’15). ACM Press, 256--268. arXiv:1504.07680 [cs.PL].Google ScholarDigital Library
- Jana Dunfield and Neelakantan R. Krishnaswami. 2013. Complete and easy bidirectional typechecking for higher-rank polymorphism. In Proceedings of the International Conference on Functional Programming (ICFP’13). ACM Press, 429--442. arXiv:1306.6032 [cs.PL].Google ScholarDigital Library
- Jana Dunfield and Neelakantan R. Krishnaswami. 2019. Sound and complete bidirectional typechecking for higher-rank polymorphism with existentials and indexed types. Proc. ACM Program. Lang. 3, Article 9 (Jan. 2019), 28 pages. arXiv:1601.05106 [cs.PL].Google ScholarDigital Library
- Jana Dunfield and Frank Pfenning. 2004. Tridirectional typechecking. In Proceedings of the Symposium on Principles of Programming Languages (POPL’04). ACM Press, 281--292.Google ScholarDigital Library
- Richard A. Eisenberg, Stephanie Weirich, and Hamidhasan G. Ahmed. 2016. Visible type application. In Proceedings of the European Symposium on Programming, Vol. 9632. Springer, 229--254.Google ScholarDigital Library
- José Espírito Santo. 2017. The polarized λ-calculus. Electronic Notes Theor. Comput. Sci. 332 (2017), 149--168.Google ScholarCross Ref
- Tim Freeman and Frank Pfenning. 1991. Refinement types for ML. In Programming Language Design and Implementation. ACM Press, 268--277.Google Scholar
- Jean-Yves Girard. 1989. Proofs and Types. Cambridge University Press.Google Scholar
- Adam Gundry, Conor McBride, and James McKinna. 2010. Type inference in context. In Proceedings of the Conference on Mathematically Structured Functional Programming (MSFP’10).Google ScholarDigital Library
- Robert Harper and Frank Pfenning. 2005. On equivalence and canonical forms in the LF type theory. Trans. Comput. Logic 6 (2005), 61--101. Issue 1.Google ScholarDigital Library
- R. Hindley. 1969. The principal type-scheme of an object in combinatory logic. Trans. Amer. Math. Soc. 146 (1969), 29--60.Google Scholar
- Haruo Hosoya and Benjamin C. Pierce. 1999. How Good is Local Type Inference?Technical Report MS-CIS-99-17. University of Pennsylvania.Google Scholar
- Danko Ilik. 2017. The exp-log normal form of types: Decomposing extensional equality and representing terms compactly. In Proceedings of the Symposium on Principles of Programming Languages (POPL’17). ACM Press, 387--399.Google ScholarDigital Library
- Khurram A. Jafery and Jana Dunfield. 2017. Sums of uncertainty: Refinements go gradual. In Proceedings of the Symposium on Principles of Programming Languages (POPL’17). ACM Press, 804--817.Google Scholar
- Trevor Jim. 1995. What are Principal Typings and What are They Good For?Technical memorandum MIT/LCS/TM-532. MIT.Google Scholar
- Neelakantan R. Krishnaswami. 2009. Focusing on pattern matching. In Proceedings of the Symposium on Principles of Programming Languages (POPL’09). ACM Press, 366--378. DOI:https://doi.org/10.1145/1480881.1480927Google ScholarDigital Library
- Joachim Lambek. 1985. Cartesian closed categories and typed lambda-calculi. In Proceedings of the 13th Spring School of the LITP on Combinators and Functional Programming Languages(LNCS, Vol. 242), Guy Cousineau, Pierre-Louis Curien, and Bernard Robinet (Eds.). Springer, 136--175. DOI:https://doi.org/10.1007/3-540-17184-3_44Google Scholar
- Oukseh Lee and Kwangkeun Yi. 1998. Proofs about a Folklore let-polymorphic type inference algorithm. ACM Trans. Prog. Lang. Sys. 20, 4 (July 1998), 707--723.Google ScholarDigital Library
- Daniel Leivant. 1986. Typing and computational properties of lambda expressions. Theor. Comput. Sci. 44 (1986), 51--68.Google ScholarDigital Library
- Paul Blain Levy. 2001. Call-By-Push-Value. Ph.D. Dissertation. Queen Mary and Westfield College, University of London.Google Scholar
- Sam Lindley, Conor McBride, and Craig McLaughlin. 2017. Do be do be do. In Proceedings of the Symposium on Principles of Programming Languages (POPL’17). ACM Press, 500--514.Google ScholarDigital Library
- Barbara H. Liskov and Jeannette M. Wing. 1994. A behavioral notion of subtyping. ACM Trans. Prog. Lang. Sys. 16, 6 (Nov. 1994), 1811--1841.Google ScholarDigital Library
- Conor McBride. 2016. I got plenty o’ nuttin’. In A List of Successes That Can Change the World: Essays Dedicated to Philip Wadler on the Occasion of His 60th Birthday, S. Lindley, C. McBride, P. Trinder, and D. Sannella (Eds.). Springer, 207--233.Google Scholar
- Robin Milner. 1978. A theory of type polymorphism in programming. J. Comput. Syst. Sci. 17, 3 (1978), 348--375.Google ScholarCross Ref
- Aleksandar Nanevski, Frank Pfenning, and Brigitte Pientka. 2008. Contextual modal type theory. ACM Trans. Comput. Logic 9, 3, Article 23(June 2008), 49 pages.Google ScholarDigital Library
- Martin Odersky, Matthias Zenger, and Christoph Zenger. 2001. Colored local type inference. In Proceedings of the Symposium on Principles of Programming Languages (POPL’01). ACM Press, 41--53.Google ScholarDigital Library
- Bruno C. d. S. Oliveira, Zhiyuan Shi, and João Alpuim. 2016. Disjoint intersection types. In Proceedings of the International Conference on Functional Programming (ICFP’16). ACM Press, 364--377.Google ScholarDigital Library
- Simon Peyton Jones, Dimitrios Vytiniotis, Stephanie Weirich, and Mark Shields. 2007. Practical type inference for arbitrary-rank types. J. Function. Program. 17, 1 (2007), 1--82.Google ScholarDigital Library
- Frank Pfenning. 2004. Sequent Calculus. Lecture notes for 15--317: Constructive Logic, Carnegie Mellon University. Retrieved from https://www.cs.cmu.edu/fp/courses/atp/handouts/ch3-seqcalc.pdf.Google Scholar
- Frank Pfenning. 2009. Lecture Notes on Harmony. Lecture notes for 15--317: Constructive Logic, Carnegie Mellon University. Retrieved from https://www.cs.cmu.edu/~fp/courses/15317-f09/lectures/03-harmony.pdf.Google Scholar
- Frank Pfenning. 2017. Lecture Notes on Verifications. Lecture notes for 15--317: Constructive Logic, Carnegie Mellon University. Retrieved from https://www.cs.cmu.edu/~crary/317-f18/lectures/05-intercalation.pdf.Google Scholar
- Frank Pfenning and Rowan Davies. 2001. A judgmental reconstruction of modal logic. Math. Struct. Comput. Sci. 11, 4 (2001), 511--540.Google ScholarDigital Library
- Frank Pfenning and Robert J. Simmons. 2009. Substructural operational semantics as ordered logic programming. In Proceedings of the Symposium on Logic in Computer Science (LICS’09). IEEE, 101--110.Google ScholarDigital Library
- Brigitte Pientka. 2008. A type-theoretic foundation for programming with higher-order abstract syntax and first-class substitutions. In Proceedings of the Symposium on Principles of Programming Languages (POPL’08). ACM Press, 371--382.Google ScholarDigital Library
- Brigitte Pientka. 2013. An insider’s look at LF type reconstruction: Everything you (n)ever wanted to know. J. Function. Program. 23, 1 (2013), 1--37. DOI:https://doi.org/10.1017/S0956796812000408Google ScholarDigital Library
- Brigitte Pientka and Jana Dunfield. 2008. Programming with proofs and explicit contexts. In Proceedings of the Conference on Principles and Practice of Declarative Programming (PPDP’08). ACM Press, 163--173.Google ScholarDigital Library
- Benjamin C. Pierce and David N. Turner. 1997. Local type inference. Technical Report CSCI #493. Indiana University.Google Scholar
- Benjamin C. Pierce and David N. Turner. 1998. Local type inference. In Proceedings of the Symposium on Principles of Programming Languages (POPL’98). ACM Press, 252--265. Full version in ACM Trans. Prog. Lang. Sys., 22(1):1--44, 2000.Google Scholar
- Benjamin C. Pierce and David N. Turner. 2000. Local type inference. ACM Trans. Prog. Lang. Sys. 22 (2000), 1--44.Google ScholarDigital Library
- Nadia Polikarpova, Ivan Kuraj, and Armando Solar-Lezama. 2016. Program synthesis from polymorphic refinement types. In Programming Language Design and Implementation. ACM Press, 522--538.Google Scholar
- François Pottier and Yann Régis-Gianas. 2006. Stratified type inference for generalized algebraic data types. In Proceedings of the Symposium on Principles of Programming Languages (POPL’06). ACM Press, 232--244.Google ScholarDigital Library
- Uday S. Reddy. 1993. A typed foundation for directional logic programming. In Extensions of Logic Programming, E. Lamma and P. Mello (Eds.). Springer, 282--318.Google Scholar
- John C. Reynolds. 1988. Preliminary Design of the Programming Language Forsythe. Technical Report CMU-CS-88-159. Carnegie Mellon University. http://doi.library.cmu.edu/10.1184/OCLC/18612825Google Scholar
- John C. Reynolds. 1996. Design of the Programming Language Forsythe. Technical Report CMU-CS-96-146. Carnegie Mellon University.Google Scholar
- Gabriel Scherer. 2017. Deciding equivalence with sums and the empty type. In Proceedings of the Symposium on Principles of Programming Languages (POPL’17). ACM Press, 374--386.Google ScholarDigital Library
- Gabriel Scherer and Andreas Abel. 2012. On irrelevance and algorithmic equality in predicative type theory. Logic. Methods Comput. Sci. 8 (2012), 1--29.Google Scholar
- Alejandro Serrano, Jurriaan Hage, Simon Peyton Jones, and Dimitrios Vytiniotis. 2020. A quick look at impredicativity. Proc. ACM Program. Lang. 4, Article 89(2020), 29 pages. DOI:https://doi.org/10.1145/3408971Google ScholarDigital Library
- Alejandro Serrano, Jurriaan Hage, Dimitrios Vytiniotis, and Simon Peyton Jones. 2018. Guarded impredicative polymorphism. In Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’18). ACM Press, 783--796. DOI:https://doi.org/10.1145/3192366.3192389Google ScholarDigital Library
- Wilfried Sieg and John Byrnes. 1998. Normal natural deduction proofs (in classical logic). Studia Logica 60, 1 (1998), 67--106.Google ScholarCross Ref
- Robert J. Simmons. 2014. Structural focalization. ACM Trans. Comput. Logic 15, 3, Article 21(Sept. 2014), 33 pages.Google ScholarDigital Library
- Vilhelm Sjöberg and Stephanie Weirich. 2015. Programming up to congruence. In Proceedings of the Symposium on Principles of Programming Languages (POPL’15). ACM Press, 369--382.Google ScholarDigital Library
- Dimitrios Vytiniotis, Simon 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 ScholarDigital Library
- Dimitrios Vytiniotis, Stephanie Weirich, and Simon L. Peyton Jones. 2006. Boxy types: Inference for higher-rank types and impredicativity. In Proceedings of the International Conference on Functional Programming (ICFP’06). ACM Press, 251--262. DOI:https://doi.org/10.1145/1159803.1159838Google ScholarDigital Library
- David H. D. Warren. 1977. Applied Logic—Its use and implementation as a programming tool. Ph.D. Dissertation. University of Edinburgh.Google Scholar
- Kevin Watkins, Iliano Cervesato, Frank Pfenning, and David Walker. 2003. A concurrent logical framework I: Judgments and properties. Technical Report CMU-CS-02-101. Carnegie Mellon University.Google Scholar
- J. B. Wells. 2002. The essence of principal typings. In Proceedings of the International Colloquium on Automata, Languages, and Programming. Springer, 913--925.Google ScholarCross Ref
- Roger Wolff, Ronald Garcia, Éric Tanter, and Jonathan Aldrich. 2011. Gradual typestate. In Proceedings of the 25th European Conference on Object-oriented Programming (ECOOP’11). Springer, 459--483.Google ScholarCross Ref
- Hongwei Xi. 1998. Dependent Types in Practical Programming. Ph.D. Dissertation. Carnegie Mellon University.Google ScholarDigital Library
- Hongwei Xi, Chiyan Chen, and Gang Chen. 2003. Guarded recursive datatype constructors. In Proceedings of the Symposium on Principles of Programming Languages (POPL’03). ACM Press, 224--235.Google ScholarDigital Library
- Hongwei Xi and Frank Pfenning. 1999. Dependent types in practical programming. In Proceedings of the Symposium on Principles of Programming Languages (POPL’99). ACM Press, 214--227.Google ScholarDigital Library
- Ningning Xie, Xuan Bi, and Bruno C. d. S. Oliveira. 2018. Consistent subtyping for all. In Proceedings of the European Symposium on Programming. Springer, 3--30.Google Scholar
- Ningning Xie and Bruno C. d. S. Oliveira. 2018. Let arguments go first. In Proceedings of the European Symposium on Programming. Springer, 272--299.Google Scholar
- Noam Zeilberger. 2015. Balanced polymorphism and linear lambda calculus. In Proceedings of the International Conference on Types for Proofs and Programs (TYPES’15).Google Scholar
- Noam Zeilberger. 2018. A theory of linear typings as flows on 3-valent graphs. In Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science (LICS’18). ACM Press, 919--928. DOI:https://doi.org/10.1145/3209108.3209121Google ScholarDigital Library
- Jinxu Zhao, Bruno C. d. S. Oliveira, and Tom Schrijvers. 2019. A mechanical formalization of higher-ranked polymorphic type inference. Proc. ACM Program. Lang. 3, Article 112(July 2019), 29 pages. DOI:https://doi.org/10.1145/3341716Google ScholarDigital Library
Index Terms
- Bidirectional Typing
Recommendations
Type checking and inference for polymorphic and existential types
CATS '09: Proceedings of the Fifteenth Australasian Symposium on Computing: The Australasian Theory - Volume 94This paper proves undecidability of type checking and type inference problems in some variants of typed lambda calculi with polymorphic and existential types. First, type inference in the domain-free polymorphic lambda calculus is proved to be ...
Bidirectional typing for Erlang
Erlang 2021: Proceedings of the 20th ACM SIGPLAN International Workshop on ErlangErlang is a strict, dynamically typed functional programming language popular for its use in distributed and fault-tolerant applications. The absence of static type checking allows ill-typed programs to cause type errors at run time. The benefits of ...
Recasting MLF
The language ML^F is a proposal for a new type system that supersedes both ML and System F, allows for efficient, predictable, and complete type inference for partially annotated terms. In this work, we revisit the definition of ML^F, following a more ...
Comments