- Aug 2020
It also adds safety through a property called parametricity. If we pretend that there are no infinite loops or exceptions (it’s okay to do that, so we will do it throughout this article), then the function is actually fully determined by its type. In other words, if we see the type a -> a, we know that the corresponding value must be the identity function.
If this would be the first time I came across parametricity, I wouldn't understand what it means.
In programming language theory, parametricity is an abstract uniformity property enjoyed by parametrically polymorphic functions, which captures the intuition that all instances of a polymorphic function act the same way.
That is, a function with the type signature
a -> ahas only one implementation: it can only return its input. In a similar fashion,
a -> b -> awill only return the first argument and ignore the second. And so on.