
On 05/02/2011 15:35, Andrew Coppin wrote:
At the very least we need to teach people how to tell which arguments a pure function is strict in by looking at its definition.
That's not necessarily tractible. It depends on what other functions you call. Many functions have obvious strictness properties, but very few have *documented* strictness properties.
It's often struck me that, this information is clearly part of the interface to a function, given that correct operation of calls to that function may depend on it, yet we (implicitly) pretend that it's not (by rarely documenting it). Would it not be both incredibly useful and possible to automatically document information of this sort using tools like haddock? Obviously, entirely accurate indicators of lazyness are not going to be computable, but it seems like we could at least get information of the type "argument never forced", "argument always forced", "argument may be forced". It seems like this would be a huge step forward - data structures like map which are pure containers for their elements would be clearly indicated as such in their documentation. Jimbo