Type inference with non-structural subtyping
- 58 Downloads
We present an O(n3) time type inference algorithm for a type system with a largest typeΤ, a smallest type ⊥, and the usual ordering between function types. The algorithm infers type annotations of least shape, and it works equally well for recursive types. For the problem of typability, our algorithm is simpler than the one of Kozen, Palsberg, and Schwartzbach for type inferencewithout ⊥. This may be surprising, especially because the system with ⊥ is strictly more powerful.
KeywordsLanguages Type systems Constraints Algorithms
Unable to display preview. Download preview PDF.
- [AmC93]Amadio, R. M. and Cardelli, L.: Subtyping recursive types.ACM Transactions on Programming Languages and Systems, 15(4):575–631, 1993. Also in Proc. POPL'91.Google Scholar
- [KPS94]Kozen, D., Palsberg, J. and Schwartzbach, M. I.: Efficient inference of partial types.Journal of Computer and System Sciences, 49(2):306–324, 1994. Preliminary version in Proc. FOCS'92, 33rd IEEE Symposium on Foundations of Computer Science, pages 363–371, Pittsburgh, Pennsylvania, October 1992.Google Scholar
- [KPS95]Kozen, D., Palsberg, J. and Schwartzbach, M. I.: Efficient recursive subtyping.Mathematical Structures in Computer Science, 5(1):113–125, 1995. Preliminary version in Proc. POPL'93, Twentieth Annual SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 419–428, Charleston, South Carolina, January 1993.Google Scholar
- [Mit84]Mitchell, J.: Coercion and type inference. InEleventh Symposium on Principles of Programming Languages, pages 175–185, 1984.Google Scholar
- [Mit91]Mitchell, J. C.: Type inference with simple subtypes.Journal of Functional Programming, 1:245–285, 1991.Google Scholar
- [PoO95]Palsberg, J. and O'Keefe, P. M.: A type system equivalent to flow analysis.ACM Transactions on Programming Languages and Systems, 17(4):576–599, July 1995. Preliminary version in Proc. POPL'95, 22nd Annual SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 367–378, San Francisco, California, January 1995.Google Scholar
- [PaS92]Palsberg, J. and Schwartzbach, M. I.: Safety analysis versus type inference for partial types.Information Processing Letters, 43:175–180, 1992.Google Scholar
- [Tha88]Thatte, S.: Type inference with partial types. InProc. International Colloquium on Automata, Languages, and Programming 1988, pages 615–629. Springer-Verlag(LNCS 317), 1988.Google Scholar
- [Wan91]Wand, M.: Type inference for record concatenation and multiple inheritance.Information and Computation, 93(1):1–15, 1991.Google Scholar
- [WOP95]Wand, M., O'Keefe, P. M. and Palsberg, J.: Strong normalization with non-structural subtyping.Mathematical Structures in Computer Science, 5(3):419–430, 1995.Google Scholar