Understanding strictness of ghc output

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Jun 22 09:37:38 EDT 2004

"Simon Peyton-Jones" <simonpj at microsoft.com> writes:

> | That contradicts my intution for seq. I would read it as "h is forced
> | before h is forced", and I would think that (h `seq` h) is equivalent
> | to h.
> | 
> | Were I am wrong?
> You're not wrong -- Malcolm is.  The function is certainly strict in h,
> and GHC finds it.  

Well, it is certainly the case that in a denotational sense the
function is strict in h, because if h is bottom, the result is bottom.

But my operational understanding is that h is a projection, that is,
it is passed from argument to result unmodified.  The demand on h
comes from the caller of the present function, which may or may not
be strict in that result.  Thus, the function code itself here does
not force the evaluation of h.


More information about the Glasgow-haskell-users mailing list