A DSL for financial contracts
The domain-specific nature of the language means that programs can be more easily understood, and often also written or modified, by domain experts who do not have a background in programming. In this section, we’ll discuss such a DSL – one for financial contracts.
The idea for this DSL was first presented in 2000 in the paper Composing Contracts and has since been highly influential. Many (investment) banks have adopted this approach and set up in-house variants of the DSL (in a much more sophisticated form than what we’ll see here). It has carved out an important job market for functional programmers in the financial sector.
Compositional contracts
A contract is an agreement between two parties: the holder and the other party. (It can be generalized to more than two parties, but we won’t go that far in this book.) A contract is always formulated from the point of view of the holder. Here is an example contract that...