Is the word "where"?

Assuming I have a function like

foo = 8 + f1
  where f1 = 8 + 9
        f2 = 8 + 10

f1clearly need to be appreciated, but f2not necessary. So will it be? I see how evaluating each expression wherewill be a performance issue.

+4
source share
1 answer

Yes, he is lazy, so he f2will not be evaluated, for example:

foo = 8 + f1
    where f1 = 8 + 9
          f2 = last [1..]

will be calculated instantly and will forever remain if it is strict.

+6
source

All Articles