I'm thinking of functions like the identity function:
val f : 'a -> 'a
let f x = x
the composition function:
val compose : ('b -> 'c) -> ('a -> 'b) -> ('a -> 'c)
let compose f g x = f (g x)
or the applicative map
function if the monadic return
and bind
functions are defined:
val return : 'a -> 'a t
val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t
val ( >>| ) : 'a t -> ('a -> 'b) -> 'b t
let ( >>| ) t f = t >>= fun x -> f x |> return
In each of these cases, there is exactly one pure function (ignoring equivalent representations of the same logic) that could be written to satisfy the function's type signature.
Is there a term for functions like this? And why is it that there can only be one implementation?