Composition is the act of taking a stack and a function, and producing the type signature of the resulting stack. It can also be equivalenty seen as the composition of two functions' execution.
- Generate constraints from the stated type sigs of your functions.
- Match the RHS of the LHF, and the LHS of the RHF, from right to left. If the two symbols are:
- Base types: Fail if one is not a parent type of the other. Otherwise, move on.
- Both function types: Add a constraint
{a -- b} = {c -- d}
and run step (4) early. If this produces an invalid constraint, try again by introducing a new variablex