Proposal: Data.Stream

Neil Mitchell ndmitchell at
Mon Jul 9 15:06:23 EDT 2007

Hi Wouter,

> I just uploaded a fairly unspectacular package Data.Stream to
> Hackage. It implements quite a few operations on streams (infinite
> lists), analogous to those defined in Data.List. Sometimes it is just
> good to know a list is infinite.

What is the advantage of knowing that a list is infinite? Are these
versions just identical to the Data.List versions, but you know you
won't encounter [] ? If so, I'm not sure there is a pressing need for
this. I would have thought a much more common problem is telling the
difference between an empty list and a non-empty list, rather than an
infinite list and another type of list.

I'm not saying that its not useful, I'm just not sure it deserves to
be in the base libraries. We could add a multitude of different data
types, each of which is "a list by some other name", but we'd probably
end up confusing users more than helping them.

As a related point, if you do use infinite lists, and are worried that
your operations might cause a pattern-match error, Catch will detect
this and prove it for you:



More information about the Libraries mailing list