6 ms·
I've usually heard this phrased as the signature implies only one possibly function, but that is in a very abstract sense. This phrasing is more intuitive as it
by justincredible 3y ago
I've usually heard this phrased as the signature implies only one possibly function, but that is in a very abstract sense. This phrasing is more intuitive as it's saying the signature constrains what the function could possibly do.
For example, if you have a function of type ℕ x ℕ -> ℕ you know it could be doing addition, multiplication or exponentiation, but it can't do division because then it could only be a partial function. A more abstract signature ℕ x ℕ x Op -> ℕ, where Op is the set of binary operations on the natural numbers, can really only do one thing (apply the operands to the operation).
Another example, [A] -> A could be any fixed indexing function, but it can't be a function that produces a value of A not found in the list as the true signature of that function is just A per se.
As a sibling comment points out, in the context of programming the signature isn't as constraining as it would be in maths as the distinction between total and partial functions is often ignored and you can have side effects. But the more you model your functions to be pure and total the more you can reason about them abstractly.