News for hackers. Stuff that matters.
Re:The Evolution of a Haskell Programmer (2001) by bbcbasic on Monday February 08, 2016 @04:44PM (#11061100)
[1..n] is not an array but a lazy-generated linked list. So you'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

I admit now I am stuck looking at http://hackage.haskell.org/package/base-4.8.2.0/docs/src/Dat... as it uses foldMap which I am not used to. According to https://wiki.haskell.org/Fold 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!

Re:The Evolution of a Haskell Programmer (2001) by platz on Monday February 08, 2016 @05:04PM (#11061212)
there are various ways to view exactly what ghc produces (i have one in my comment below)