Typed Contracts for Functional Programming
Ralf Hinze, Johan Jeuring, and Andres Löh

A robust software component fulfills a contract: it expects data satisfying a certain property and promises to return data satisfying another property. The object-oriented community uses the design-by-contract approach extensively. Proposals for language extensions that add contracts to higher-order functional programming have appeared recently. In this paper we propose an embedded domain-specific language for typed, higher-order and first-class contracts, which is both more expressive than previous proposals, and allows for better blame assignment. We take some first steps towards an algebra of contracts, and we show how to define a generic contract combinator for arbitrary algebraic data types. The contract language is implemented as a library in Haskell using the concept of generalised algebraic data types.

Paper, accepted at FLOPS 2006
Source code

Valid XHTML 1.0! Valid CSS!

Andres Löh, 2006-09-08