This FAQ says that
The seq operator is
seq :: a -> b -> bx
seqy will evaluate x, enough to check that it is not bottom, then
discard the result and evaluate y. This might not seem useful, but it
means that x is guaranteed to be evaluated before y is considered.
That’s awfully nice of Haskell, but does it mean that in
x `seq` f x
the cost of evaluating x will be paid twice (“discard the result”)?
The
seqfunction will discard the value ofx, but since the value has been evaluated, all references toxare “updated” to no longer point to the unevaluated version ofx, but to instead point to the evaluated version. So, even thoughseqevaluates and discardsx, the value has been evaluated for other users ofxas well, leading to no repeated evaluations.