Composing contracts: an adventure in financial engineering
- SL Peyton Jones ,
- J-M Eber ,
- J Seward ,
- Simon Peyton Jones
ACM SIGPLAN International Conference on Functional Programming (ICFP'00) |
Published by ACM Press
Financial and insurance contracts do not sound like promising territory for functional programming and formal semantics, but in fact we have discovered that insights from programming languages bear directly on the complex subject of describing and valuing a large class of contracts.
We introduce a combinator library that allows us to describe such contracts precisely, and a compositional denotational semantics that says what such contracts are worth. We sketch an implementation of our combinator library in Haskell. Interestingly, lazy evaluation plays a crucial role.
A revised and updated version of this paper appeared as How to write a financial contract (opens in new tab), a chapter in “The Fun of Programming”, ed Gibbons and de Moor, Palgrave Macmillan 2003.
Anton van Staten has a written a self-contained, well-documented Haskell library of composable contracts (opens in new tab), which looks like a great resource if you want to try executing some contracts.