[Haskell-cafe] Example programs with ample use of deepseq?

Evan Laforge qdunkan at gmail.com
Tue Jan 8 22:01:41 CET 2013


> surprisingly, deepseq is not used as much as I thought.
> http://packdeps.haskellers.com/reverse/deepseq lists a lot of packages,
> but (after grepping through some of the code) most just define NFData
> instances and/or use it in tests, but rarely in the „real“ code. For
> some reason I expected it to be in more widespread use.

I've been using deepseq quite a bit lately, but for the purpose of
debugging space leaks.  If, when I deepseq a big structure, the space
leak goes away, I can then apply it to some subset.  After much
trial-and-error I can find something which is insufficiently strict.
Ideally I can then strictify that one thing and stop using the
deepseq.  I wish there was a more efficient way to do this.

I also use it to explicitly force certain parts of a data structure so
they evaluate in parallel, though that part is not actually done yet.



More information about the Haskell-Cafe mailing list