Possible Duplicate:
When is memoization automatic in GHC Haskell?
It looks like Haskell does not memoize all and every function by default - please note, I'm new to Haskell, so I might have that wrong, and I might be very naive about "universal memoization". This question is to understand if/why Haskell can memoize any function at the language level (maybe a silly question), and if not, what are the challenges? Also, are there other FP languages out there that provide "universal memoization" by default?
I'm curious about this because I tried to write such a "universal memoizer" in Python recently, and realized that there are significant challenges: managing the cache intelligently is one. But also, manufacturing keys from function arguments efficiently in all cases can be challenging. In my applications, it looked like handcrafting application-specific cache keys was more efficient, but that's not always easy. That's when I started wondering about Haskell, and whether Haskell had internal tricks to memoize efficiently on any function argument(s).
Just trying to learn about memoization, FP and Haskell.