Haskell and memoization of pure function results [duplicate]
Possible Duplicate: When is memoization automatic in GHC Haskell? As a consequence, pure function always returns the same value for a fixed input. That said, does Haskell (more precisely GHC) automatically cache (memoize) these results if there is enough memory (question 1) and does developer have any control on it (question 2)? Philip JF I voted to close, but short answer: GHC does not do any automatic memoization of functions, and that is probably a good thing because it would make space complexity even harder to reason about. Also, memoization is not in general a very solvable problem,