The Recursive Union of Some Gradual Types

  • Jeremy G. SiekEmail author
  • Sam Tobin-Hochstadt
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9600)


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.


Type System Operational Semantic Union Type Reduction Rule Typing Rule 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. Amadio, R.M., Cardelli, L.: Subtyping recursive types. ACM Trans. Program. Lang. Syst. 15(4), 575–631 (1993)CrossRefGoogle Scholar
  2. Brandt, M., Henglein, F.: Coinductive axiomatization of recursive type equality and subtyping. Fundam. Inf. 33(4), 309–338 (1998)MathSciNetzbMATHGoogle Scholar
  3. Cartwright, R., Fagan, M.: Soft typing. In: Conference on Programming Language Design and Implementation, PLDI, pp. 278–292. ACM Press (1991)Google Scholar
  4. 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
  5. 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
  6. Flatt, M., and PLT.: The Racket reference 6.0. Technical report, PLT Inc. (2014).
  7. Frisch, A., Castagna, G., Benzaken, V.: Semantic subtyping: dealing set-theoretically with function, union, intersection, and negation types. J. ACM 55(4), 19: 1–19: 64 (2008)MathSciNetCrossRefzbMATHGoogle Scholar
  8. Kelsey, R., Clinger, W., Rees, J.: Revised\(^5\) report on the algorithmic language scheme. High.-Order Symbolic Comput. 11(1), 7–105 (1998)MathSciNetCrossRefGoogle Scholar
  9. Pierce, B.C.: Programming with intersection types, union types, and polymorphism. Technical report CMU-CS-91-106, Carnegie Mellon University (1991)Google Scholar
  10. Pierce, B.C.: Types and Programming Languages. MIT Press, Cambridge (2002)zbMATHGoogle Scholar
  11. Siek, J.G., Taha, W.: Gradual typing for objects. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 2–27. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  12. 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
  13. Tobin-Hochstadt, S., Felleisen, M.: The design and implementation of Typed Scheme. In: Symposium on Principles of Programming Languages, January 2008Google Scholar
  14. Tobin-Hochstadt, S., Felleisen, M.: Logical types for untyped languages. In: International Conference on Functional Programming, ICFP, pp. 117–128. ACM (2010)Google Scholar
  15. Vouillon, J.: Subtyping union types. In: Marcinkowski, J., Tarlecki, A. (eds.) CSL 2004. LNCS, vol. 3210, pp. 415–429. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  16. Wadler, P., Findler, R.B.: Well-typed programs can’t be blamed. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 1–16. Springer, Heidelberg (2009)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2016

Authors and Affiliations

  1. 1.Indiana UniversityBloomingtonUSA

Personalised recommendations