Need principled approach to strictness properties in Data.Map.Strict

wren ng thornton wren at freegeek.org
Mon Nov 21 00:19:40 CET 2011


On 11/20/11 3:14 PM, Edward Z. Yang wrote:
> Here is perhaps one alternate way to frame the documentation:
>
>      Rule (1) applies to first-order functions (they take the value directly)
>      Rule (2) applies to higher-order functions (they take functions which generate the value)
>
> I think the appeal of only specifying (2) is that it is *consistent*, though
> perhaps not in the way someone who hasn't thought too carefully about the issue
> would immediately assume.  I admit, I do fear that there exist some higher
> order functions for which we really don't want (1) to apply, but fortunately,
> it's easier to work around being overly strict than being overly lazy.

If we had (1) apply only to first-order functions, then that would 
address the expressivity concerns I mentioned in the other reply. So I'm 
all for (1) in the first-order case; which is, as Edward says, just a 
degenerate version of (2).

However, unless someone can (a) demonstrate efficiency reasons for 
applying (1) in the higher-order case, or (b) demonstrate another way of 
constructing semilazy operations, I'd prefer that (1) does not apply to 
the higher-order case in any way other than is required by (2).

-- 
Live well,
~wren



More information about the Libraries mailing list