instagram

Contracts tell us how to use a function, by telling us three important things:

  1. The Name
  2. The Domain of the function - what kinds of inputs do we need to give the function, and how many?
  3. The Range of the function - what kind of output will the function give us back?

For example: The contract triangle :: (Number, String, String) -> Image tells us that the name of the function is triangle, it needs three inputs (a Number and two Strings), and it produces an Image.

With these three pieces of information, we know that typing will evaluate to an Image.

Name Domain Range