|
|
|
|
|
by gloria_mundi
1102 days ago
|
|
> To be absolutely clear, the expressions `seq f (putStrLn "hello")` and `seq (f undefined) (putStrLn "hello")` should both not evaluate anything and cause the string hello to be printed rather than raising an exception. This does actually work here, because the array is created lazily. > This often occurs in cases where the above hypothetical function `f` requires an intermediate value that's expensive to compute but only relies on the first of its two arguments. Then do you evaluate that expensive intermediate with a partial application of a single argument, or do you not? Neither is satisfactory and so this problem is best avoided. Computing the intermediate value with a partial application does not actually take away laziness, it only adds sharing. (At least it can be done this way.) |
|