http://stackoverflow.com/questions/5749039/automatic-memoizi...
I think the answer is basically that there is no good heuristic about what to store, how much and how long.
In Python you can just put a @memoize decorator before a function you want memoized; would it be possible to have something similar in Haskell?
Note that in Python, you also have the issue that you still need to specify some cleverness about how long something is stored and what is stored. Many example memoize implementations just store everything (e.g.: https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize) but of course that is not a solution in practice.
It should be possible to use UnsafePerformIO to create a generic function memoize function (at least for inputs that implelemt Eq or Ord), but that is almost definantly overkill and asking for space leaks.