# The semantics of Miranda's algebraic types

## Abstract

Miranda has two interesting features in its typing system: implicit polymorphism (also known as ML-style polymorphism) and algebraic types. Algebraic types create new types from old and can operate on arbitrary types. This paper argues that functions on types, or *type constructors*, best represent the meaning of algebraic types. Building upon this idea, we develop a denotational semantics for algebraic types. We first define a typed lambda calculus that specifies type constructors. A semantic model of type constructors is then built, using the ideal model as a basis. (The ideal model gives the most natural semantics for Miranda's implicit polymorphism.) The model is shown to be sound with respect to this lambda calculus. Finally, we demonstrate how to use the model to interpret algebraic types, and prove that the translation produces elements in the model.

## Keywords

Ideal Model Constructor Expression Semantic Model Semantic Function Denotational Semantic## Preview

Unable to display preview. Download preview PDF.

## References

- [ABL86]Roberto Amadio, Kim B. Bruce, and Giuseppe Longo. The finitary projection model for second order lambda calculus and solutions to higher order domain equations. In
*First Annual Symposium on Logic in Computer Science*, Cambridge, MA, 1986.Google Scholar - [BMM85]Kim B. Bruce, Albert R. Meyer, and John C. Mitchell. The semantics of second-order lambda calculus. 1985. To appear,
*Information and Computation*.Google Scholar - [BMS80]R. M. Burstall, D. B. MacQueen, and D. T. Sannella. Hope: an experimental applicative language. In
*Proceedings of the First International LISP Conference*, Stanford, CA, 1980.Google Scholar - [DD85]Alan Demers and James Donahue. Data types are values.
*ACM Transactions on Programming Languages and Systems*, 7:426–445, July 1985.CrossRefGoogle Scholar - [DoD83]U.S. Department of Defense.
*Reference Manual for the Ada Programming Language*, Springer-Verlag, New York, 1983.Google Scholar - [Gir71]J.-Y. Girard. Une extension de l'interpretation de Gödel à l'analyse, et son application à l'élimination des coupures dans l'analyse et al théorie des types. In J.E. Fenstad, editor,
*Second Scandanavian Logic Symposium*, pages 63–92, North Holland, Amsterdam, 1971.Google Scholar - [Jon87]Simon L. Peyton Jones.
*The Implementation of Functional Programming Languages*, Prentice-Hall, Englewood Cliffs, NJ, 1987.Google Scholar - [KS85]Matthew Kaufmann and Douglas Surber.
*Syntax, Semantics, and a Formal Logic for SASL*. Technical Report ARC 85-03, Burroughs Austin Research Center, January 1985.Google Scholar - [McC79]Nancy McCracken.
*An Investigation of a Programming Language with a Polymorphic Type Structure*. PhD thesis, Syracuse University, 1979.Google Scholar - [Mil78]Robin Milner. A theory of type polymorphism.
*Journal of Computer and System Sciences*, 17:348–375, 1978.CrossRefGoogle Scholar - [MPS84]D. B. MacQueen, Gordon Plotkin, and Ravi Sethi. An ideal model for recursive polymorphic types. In
*Proceedings of the Eleventh ACM Symposium on the Principles of Programming Languages*, Salt Lake City, UT, pages 165–174, 1984.Google Scholar - [MPS86]D. B. MacQueen, Gordon Plotkin, and Ravi Sethi. An ideal model for recursive polymorphic types.
*Information and Control*, 71, 1986.Google Scholar - [MS82]D. B. MacQueen and Ravi Sethi. A semantic model of types for applicative languages. In
*1982 ACM Symposium on Lisp and Functional Programming*, Pittsburgh, PA, pages 243–252, 1982.Google Scholar - [Rey74]John C. Reynolds. Towards a theory of type structure. In
*Proceedings Colloque sur la Programmation, Lecture Notes in Computer Science 19*, pages 408–425, Springer-Verlag, New York, 1974.Google Scholar - [Rie86]Jon G. Riecke. A denotational approach to the semantics of polymorphic languages. B.A. Honors Thesis, Department of Computer Science, Williams College. 1986.Google Scholar
- [Sco82]Dana S. Scott. Domains for denotational semantics. In M. Nielsen and E. M. Schmidt, editors,
*Automata, Languages, and Programming, Lecture Notes in Computer Science 140*, pages 577–613, Springer-Verlag, New York, 1982.Google Scholar - [Str67]Christopher Strachey. Fundamental concepts in programming languages. Lecture notes for International Summer School in Computer Programming, Copenhagen. August 1967.Google Scholar
- [Tho87]Simon Thompson. Lawful types in Miranda. Unpublished manuscript. 1987.Google Scholar
- [Tur85a]David A. Turner. Functional programs as executable specifications. In Hoare and Shepherdson, editors,
*Mathematical Logic and Programming Languages*, pages 29–54, Prentice-Hall, Englewood Cliffs, NJ, 1985.Google Scholar - [Tur85b]David A. Turner. Miranda: a non-strict functional language with polymorhic types. In
*Proceedings IFIP International Conference on Functional Programming Languages and Computer Architecture, Nancy, Lecture Notes in Computer Science 201*, Springer-Verlag, New York, 1985.Google Scholar