Skip to main content
    • Aa
    • Aa
  • Get access
    Check if you have access via personal or institutional login
  • Cited by 4
  • Cited by
    This article has been cited by the following publications. This list is generated based on data provided by CrossRef.

    Greenberg, Michael 2015. Space-Efficient Manifest Contracts. ACM SIGPLAN Notices, Vol. 50, Issue. 1, p. 181.

    Greenberg, Michael 2015. Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages - POPL '15. p. 181.

    Swords, Cameron Sabry, Amr and Tobin-Hochstadt, Sam 2015. Expressing contract monitors as patterns of communication. ACM SIGPLAN Notices, Vol. 50, Issue. 9, p. 387.

    Swords, Cameron Sabry, Amr and Tobin-Hochstadt, Sam 2015. Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming - ICFP 2015. p. 387.


Contracts made manifest*

  • DOI:
  • Published online: 29 May 2012

Since Findler and Felleisen (Findler, R. B. & Felleisen, M. 2002) introduced higher-order contracts, many variants have been proposed. Broadly, these fall into two groups: some follow Findler and Felleisen (2002) in using latent contracts, purely dynamic checks that are transparent to the type system; others use manifest contracts, where refinement types record the most recent check that has been applied to each value. These two approaches are commonly assumed to be equivalent—different ways of implementing the same idea, one retaining a simple type system, and the other providing more static information. Our goal is to formalize and clarify this folklore understanding. Our work extends that of Gronski and Flanagan (Gronski, J. & Flanagan, C. 2007), who defined a latent calculus λC and a manifest calculus λH, gave a translation φ from λC to λH, and proved that if a λC term reduces to a constant, so does its φ-image. We enrich their account with a translation ψ from λH to λC and prove an analogous theorem. We then generalize the whole framework to dependent contracts, whose predicates can mention free variables. This extension is both pragmatically crucial, supporting a much more interesting range of contracts, and theoretically challenging. We define dependent versions of λH and two dialects (“lax” and “picky”) of λC, establish type soundness—a substantial result in itself, for λH — and extend φ and ψ accordingly. Surprisingly, the intuition that the latent and manifest systems are equivalent now breaks down: the extended translations preserve behavior in one direction, but in the other, sometimes yield terms that blame more.

Linked references
Hide All

This list contains references from the content that can be linked to their source. For a full set of references and notes please see the PDF or HTML where available.

R. B. Findler & M. Blume (2006) Contracts as pairs of projections. In Proceedings of the Functional and Logic Programming (FLOPS), Fuji Susono, Japan, LNCS vol. 3945, pp. 226241.

R. B. Findler & M. Felleisen (2002) Contracts for higher-order functions. In Proceedings of the Seventh ACM SIGPLAN International Conference on International Conference on Functional Programming (ICFP), Pittsburgh, PA, USA, pp. 4859.

R. Hinze , J. Jeuring & A. Löh (2006) Typed contracts for functional programming. In Proceedings of the Functional and Logic Programming (FLOPS), Fuji Susono, Japan, LNCS vol. 3945, pp. 208225.

K. Knowles & C. Flanagan (January 2010) Hybrid type checking. ACM Trans. Program. Lang. Syst. (TOPLAS) 32 (2), Article 6, 34 pp.

B. Meyer (1992) Eiffel: The Language. Upper Saddle River, NJ: Prentice-Hall.

A. K. Wright & M. Felleisen (1994) A syntactic approach to type soundness. Inf. Comput. 115, 3894.

Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *