Creates a memoized version of the receiver function.
The function to be memoized.
A function that caches results for previously used inputs.
The input type for the function.
The output type of the function.