The Recursive Union of Some Gradual Types
- 1.1k Downloads
We study union types and recursive types in the setting of a gradually typed lambda calculus. Our goal is to obtain a foundational account for languages that enable recursively defined data structures to be passed between static and dynamically typed regions of a program. We discuss how traditional sum types are not appropriate for this purpose and instead study a form of “true” union in the tradition of soft typing (Cartwright and Fagan, 1991) and occurrence typing (Tobin-Hochstadt and Felleisen, 2008). Regarding recursive types, our formulation is based on the axiomatization of subtyping by Brand and Henglein (1998).
This paper defines three artifacts. First, in the context of the simply typed lambda calculus, we define the semantics of our unions and integrate them with equi-recursive types. Second, we add a dynamic type \(\star \) to obtain a gradually typed lambda calculus. Its semantics is defined by translation to the third artifact, a blame calculus (Wadler and Findler, 2009) extended with unions and equi-recursive types.
KeywordsType System Operational Semantic Union Type Reduction Rule Typing Rule
- Cartwright, R., Fagan, M.: Soft typing. In: Conference on Programming Language Design and Implementation, PLDI, pp. 278–292. ACM Press (1991)Google Scholar
- Castagna, G., Nguyen, K., Xu, Z., Im, H., Lenglet, S., Padovani, L.: Polymorphic functions with set-theoretic types: part 1: syntax, semantics, and evaluation. In: Symposium on Principles of Programming Languages, POPL, pp. 5–17. ACM (2014)Google Scholar
- Cimini, M., Siek, J.G.: The gradualizer: a methodology and algorithm for generating gradual type systems. In: Symposium on Principles of Programming Languages, POPL, January 2016Google Scholar
- Flatt, M., and PLT.: The Racket reference 6.0. Technical report, PLT Inc. (2014). http://docs.racket-lang.org/reference/index.html
- Pierce, B.C.: Programming with intersection types, union types, and polymorphism. Technical report CMU-CS-91-106, Carnegie Mellon University (1991)Google Scholar
- Siek, J.G., Thiemann, P., Wadler, P.: Blame and coercion: together again for the first time. In: Conference on Programming Language Design and Implementation, PLDI, June 2015Google Scholar
- Tobin-Hochstadt, S., Felleisen, M.: The design and implementation of Typed Scheme. In: Symposium on Principles of Programming Languages, January 2008Google Scholar
- Tobin-Hochstadt, S., Felleisen, M.: Logical types for untyped languages. In: International Conference on Functional Programming, ICFP, pp. 117–128. ACM (2010)Google Scholar