Proposal: Make intersperse lazier

Duncan Coutts duncan.coutts at googlemail.com
Thu Sep 16 12:07:38 EDT 2010


On 16 September 2010 16:41, Daniel Fischer <daniel.is.fischer at web.de> wrote:
> On Thursday 16 September 2010 17:08:08, Duncan Coutts wrote:

>> We would also need to change intercalate to match:
>>
>> intercalate sep (x : _|_) = x ++ _|_
>>
>> Note that the current definition of intercalate in the base package
>> will not need to change because it is defined in terms of intersperse,
>> but its strictness specification does change.
>>
>> Assuming the proposal is updated with the corresponding change to
>> intercalate,
>
> You mean, also mention the consequences for intercalate explicitly?
> Or something more/else?

The point is that we are proposing to change the strictness properties
of both intersperse and intercalate. Ideally the proposal should state
the old and new strictness properties of both functions and give a
definition for each that satisfies the strictness property. The fact
that the old and new definitions for intercalate will be textually
identical does not really matter, it's behaviour has certainly
changed.

(In principle we could go a step further and give a testable property
that states that the new definitions refine the existing ones.)

Duncan


More information about the Libraries mailing list