How lazy is DData.Seq?

Simon Marlow simonmar at microsoft.com
Mon May 10 11:39:39 EDT 2004


On 10 May 2004 00:02, JP Bernardy wrote:

>> What do you mean with this?  Do you mean: "I think
>> *I* was mistaken [...]"?
> 
> Huh, yes.
> 
>>> The current version behaves ok for sequences mainly constructed with
>>> fromList, cons or snoc; a sequence made up of 'append' is strict.
>> 
>> Would it be possible to change this behavior?
> 
> Sure.
> I attach the modified version, for reference.

Ross's point about requiring append to be strict in order to guarantee
O(n) toList is a good one.  In fact, the current implementation isn't
quite correct: either fromList should be strict, or append should check
for an empty Many constructor.

Cheers,
	Simon


More information about the Libraries mailing list