[Haskell-cafe] Re: ANNOUNCE: deepseq-1.0.0.0

Malcolm Wallace malcolm.wallace at cs.york.ac.uk
Tue Nov 17 23:05:34 EST 2009


> The documentation claim that "The default implementation of  
> 'deepseq' is simply 'seq'" is not exactly right, as `deepseq` and  
> `seq` have different signatures.

Yes indeed.  In order to use deepseq, it looks like I also need some  
way to force the () return value, e.g.

     let res = deepseq (my big computation)
     in res `seq` use res

or

     let res = deepseq (my big computation)
     in case res of () -> use res

I suppose the advantage of this approach is to ensure that the user  
must let-bind the forced value to a name.  A beginner might write
     (my big computation) `seq` use (my big computation)
without realising that it fails to do what they desire.

Regards,
     Malcolm



More information about the Haskell-Cafe mailing list