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.
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.