Dear Haskell Community,

I have been bedeviled by a persistent confusion about one aspect of where/let clauses, which I think I can illustrate more easily with code than with words.  Given code like this:

averageR pxls = map (pcast . setR ravg) pxls'
  where (ravg,_,_) = averages pxls'
        pxls'              = map pcast pxls

What happens if I substitute pxls' for its right-hand side,

averageR pxls = map (pcast . setR ravg) (map pcast pxls)
  where (ravg,_,_) = averages (map pcast pxls)

My "superstition" here has been that the former only evaluates pxls' once, whereas the latter computes it twice.  This seems like a basic issue which must have been confirmed or debunked somewhere in my readings, but it hasn't sunk in with me.