
On Mon, May 26, 2014 at 04:25:35PM +0200, Daniel Trstenjak wrote:
On Mon, May 26, 2014 at 08:21:36PM +0700, Kim-Ee Yeoh wrote:
The length function strikes me as a kludgy stand-in for rnf when rnf is really what's meant.
And depending on the type of the list entries, calling length won't always have the same effect then calling rnf on the list and therefore on all entries of the list.
Though I could imagine a situation where one wants to force the spine of the list but not the elements it contains. In that case rnf would do too much, and 'length' would do the right thing. However, 'length' still feels kludgy here. What is really wanted is a domain-specific language for expressing which parts of a structure should be forced. Such a domain-specific language can be found here: http://hackage.haskell.org/package/parallel-3.2.0.4/docs/Control-Seq.html In particular, forcing the spine of a list but not its elements can be expressed by evaluate (puzzles `using` seqList r0) . -Brent