Consider this function:
f as = if length as > 100 then length as else 100
Since the function is pure it\'s obvious that the length will
The case you are describing has more to do with common subexpression elimination than memoization, however it seems that GHC currently doesn't do that either because unintended sharing might lead to space leaks.