[1..n] is not an array but a lazy-generated linked list. So you&#x27;d get a space leak only if it loaded the entire list in memory, or it kept all of the intermediate calculations (called thunks) in memory. The question is does it do that, or can it use tail-call optimisation, which would effectively compile to a loop with an accumulating variable, discarding the thunks<p>I admit now I am stuck looking at <a href="http:&#x2F;&#x2F;hackage.haskell.org&#x2F;package&#x2F;base-4.8.2.0&#x2F;docs&#x2F;src&#x2F;Data.Foldable.html#product" rel="nofollow">http:&#x2F;&#x2F;hackage.haskell.org&#x2F;package&#x2F;base-4.8.2.0&#x2F;docs&#x2F;src&#x2F;Dat...</a> as it uses foldMap which I am not used to. According to <a href="https:&#x2F;&#x2F;wiki.haskell.org&#x2F;Fold" rel="nofollow">https:&#x2F;&#x2F;wiki.haskell.org&#x2F;Fold</a> foldl can make use of TCO. When I get some time I will see if I can produce the thunks as I am very interested i this!