ABSTRACT
Dependent types provide a strong foundation for specifying and verifying rich properties of programs through type-checking. The earliest implementations combined dependency, which allows types to mention program variables; with type-level computation, which facilitates expressive specifications that compute with recursive functions over types. While many recent applications of dependent types omit the latter facility, we argue in this paper that it deserves more attention, even when implemented without dependency.
In particular, the ability to use functional programs as specifications enables statically-typed metaprogramming: programs write programs, and static type-checking guarantees that the generating process never produces invalid code. Since our focus is on generic validity properties rather than full correctness verification, it is possible to engineer type inference systems that are very effective in narrow domains. As a demonstration, we present Ur, a programming language designed to facilitate metaprogramming with first-class records and names. On top of Ur, we implement Ur/Web, a special standard library that enables the development of modern Web applications. Ad-hoc code generation is already in wide use in the popular Web application frameworks, and we show how that generation may be tamed using types, without forcing metaprogram authors to write proofs or forcing metaprogram users to write any fancy types.
- Thorsten Altenkirch and Conor McBride. Generic programming within dependently typed programming. In Proc. IFIP TC2/WG2.1 Working Conference on Generic Programming, 2003. Google ScholarDigital Library
- Lennart Augustsson. Cayenne - a language with dependent types. In Proc. ICFP, 1998. Google ScholarDigital Library
- Yves Bertot and Pierre Castéran. Interactive Theorem Proving and Program Development. Coq'Art: The Calculus of Inductive Constructions. Texts in Theoretical Computer Science. Springer Verlag, 2004. Google ScholarDigital Library
- Matthias Blume, Umut A. Acar, and Wonseok Chae. Extensible programming with first-class cases. In Proc. ICFP, 2006. Google ScholarDigital Library
- Chiyan Chen and Hongwei Xi. Combining programming with theorem proving. In Proc. ICFP, 2005. Google ScholarDigital Library
- Jeremy Condit, Matthew Harren, Zachary Anderson, David Gay, and George Necula. Dependent types for low-level programming. In Proc. ESOP, 2007. Google ScholarDigital Library
- Web Application Security Consortium. 2007 Web application security statistics. http://projects.webappsec.org/Web-Application-Security-Statistics.Google Scholar
- Manuel Fähndrich, Michael Carbin, and James R. Larus. Reflective program generation with patterns. In Proc. GPCE, 2006. Google ScholarDigital Library
- Benedict R. Gaster and Mark P. Jones. A polymorphic type system for extensible records and variants. Technical Report NOTTCS-TR-96-3, University of Nottingham, 1996.Google Scholar
- Robert Harper and Benjamin Pierce. A record calculus based on symmetric concatenation. In Proc. POPL, 1991. Google ScholarDigital Library
- Shan Shan Huang and Yannis Smaragdakis. Expressive and safe static reflection with MorphJ. In Proc. PLDI, 2008. Google ScholarDigital Library
- Mark P. Jones. Type classes with functional dependencies. In Proc. ESOP, 2000. Google ScholarDigital Library
- Oleg Kiselyov, Ralf Lämmel, and Keean Schupke. Strongly typed heterogeneous collections. In Proc. Haskell Workshop, 2004. Google ScholarDigital Library
- Kenneth Knowles, Aaron Tomb, Jessica Gronski, Stephen N. Freund, and Cormac Flanagan. Sage: Unified hybrid checking for first-class types, general refinement types, and Dynamic. In Proc. Scheme Workshop, 2006.Google Scholar
- Daan Leijen and Erik Meijer. Domain specific embedded compilers. In Proc. DSL, 1999. Google ScholarDigital Library
- David MacQueen. Modules for Standard ML. In Proc. LFP, 1984. Google ScholarDigital Library
- Ulf Norell. Towards a practical programming language based on dependent type theory. PhD thesis, Chalmers University of Technology, 2007.Google Scholar
- Atsushi Ohori. A polymorphic record calculus and its compilation. TOPLAS, 17(6), 1995. Google ScholarDigital Library
- Atsushi Ohori and Peter Buneman. Type inference in a database programming language. In Proc. LFP, 1988. Google ScholarDigital Library
- Christine Paulin-Mohring. Inductive definitions in the system Coq - rules and properties. In Proc. TLCA, 1993. Google ScholarDigital Library
- Frank Pfenning. Partial polymorphic type inference and higher-order unification. In Proc. LFP, 1988. Google ScholarDigital Library
- Benjamin C. Pierce. Higher-order polymorphism. In Types and Programming Languages, chapter 30. MIT Press, 2002.Google ScholarDigital Library
- François Pottier. A 3-part type inference engine. In Proc. ESOP, 2000. Google ScholarDigital Library
- Didier Rémy. Type inference for records in a natural extension of ML. Theoretical Aspects of Object-Oriented Programming, 1994.Google ScholarDigital Library
- Patrick Rondon, Ming Kawaguchi, and Ranjit Jhala. Liquid types. In Proc. PLDI, 2008. Google ScholarDigital Library
- Tom Schrijvers, Simon Peyton Jones, Manuel Chakravarty, and Martin Sulzmann. Type checking with open type functions. In Proc. ICFP, 2008. Google ScholarDigital Library
- Tom Schrijvers, Simon Peyton Jones, Martin Sulzmann, and Dimitrios Vytiniotis. Complete and decidable type inference for GADTs. In Proc. ICFP, 2009. Google ScholarDigital Library
- Zhong Shao, Christopher League, and Stefan Monnier. Implementing typed intermediate languages. In Proc. ICFP, 1998. Google ScholarDigital Library
- Tim Sheard. Languages of the future. In Proc. OOPSLA, 2004. Google ScholarDigital Library
- Alexandra Silva and Joost Visser. Strong types for relational databases. In Proc. Haskell Workshop, 2006. Google ScholarDigital Library
- Mitchell Wand. Type inference for record concatenation and multiple inheritance. Information and Computation, 93(1), 1991. Google ScholarDigital Library
- J. B. Wells. Typability and type checking in System F are equivalent and undecidable. Annals of Pure and Applied Logic, 98:111--156, 1999.Google ScholarCross Ref
- Hongwei Xi. Dependent ML: an approach to practical programming with dependent types. J. Functional Programming, 17(2):215--286, 2007. Google ScholarDigital Library
Index Terms
- Ur: statically-typed metaprogramming with type-level record computation
Recommendations
Ur: statically-typed metaprogramming with type-level record computation
PLDI '10Dependent types provide a strong foundation for specifying and verifying rich properties of programs through type-checking. The earliest implementations combined dependency, which allows types to mention program variables; with type-level computation, ...
Extensible type-directed editing
TyDe 2018: Proceedings of the 3rd ACM SIGPLAN International Workshop on Type-Driven DevelopmentDependently typed programming languages, such as Idris and Agda, feature rich interactive environments that use informative types to assist users with the construction of programs. However, these environments have been provided by the authors of the ...
Elaborator reflection: extending Idris in Idris
ICFP 2016: Proceedings of the 21st ACM SIGPLAN International Conference on Functional ProgrammingMany programming languages and proof assistants are defined by elaboration from a high-level language with a great deal of implicit information to a highly explicit core language. In many advanced languages, these elaboration facilities contain powerful ...
Comments