News for hackers. Stuff that matters.
Re:Haskell in Production: Standard Chartered by ghostwriter on Wednesday May 03, 2023 @04:09PM (#35807095)
> In a strict language, you can say (roughly at least) that replacing [] with [1..n] will add at minimum a certain number of extra CPU cycles and a certain amount of additional allocation.

It's not at minimum, it's always the worst case cost of N in strict languages, whereas the lazy setting provides you with amortized complexity.

Re:Haskell in Production: Standard Chartered by foldr on Wednesday May 03, 2023 @07:34PM (#35809292)
It is at a minimum, because the rest of the code might e.g. execute some arbitrarily expensive computation in the case where the list has a certain number of elements. I'm talking about the case of replacing a [] constant in some arbitrary piece of code with something like [1..10000]. Given strict semantics you'll of course incur at least the time and space costs associated with constructing the list, but you might also incur additional costs depending on what the rest of the code does with the list.