Well, sure, running code in interpreter does less optimizations than doing full compilation. I can write an interpreter for your C code which runs out of memory if you want :) So your "you can tell" depends on particular compiler or interpreter implementation, and no, you can't tell what my compiler will do.
I'll have to agree with that. But then I would also say that I had to make some assumptions, right? :)
I think GHCi is helpful in this situation, however. It clearly distinguishes between leaky and non-leaky code. This leak is a product of "just doing what the coder says" (go to "Data.Monoid.sum" and do what it says there with such and such...). I'm assuming that, for this code, GHCi is bug-free.
I think
sum (replicate n 0)
is as dangerous as
foldl (+) 0 (replicate n 0)
or
foldr (+) 0 (replicate n 0)
. `sum (replicate n 0)` may be the right thing to do in some cases unknown to me.
There is `{-# LANGUAGE Strict #-}`, as you mention, and BangPatterns for strict arguments. But I would assume, those are used only by coders already familiar with haskell and its leaky pitfalls.