RFC: general sequences

Benjamin Franksen benjamin.franksen at bessy.de
Tue May 24 05:21:17 EDT 2005


On Tuesday 24 May 2005 02:00, Ross Paterson wrote:
> On Mon, May 23, 2005 at 10:22:38PM +0200, Benjamin Franksen wrote:
> > On Monday 23 May 2005 18:41, Bulat Ziganshin wrote:
> > > at least, it will be great to have analogues of length, map,
> > > filter, partition and a number of other operations defined in
> > > classes and supported for variety of data structures. i think
> > > it's omission in H98 standard that this names belongs only to
> > > lists and not defined in some classes like (+) and (>)
> >
> > A agree completely. Almost all of the functions in Data.Seq have
> > the same name and type signature (modulo the data type) and provide
> > the same functionality as the corresponding ones for lists (in the
> > Prelude). A type class Sequence to capture these common features
> > would be great. It would also mean we can import module Sequence
> > unqualified. A problem is that the names conflict with the ones
> > from the Prelude, so that this style can only be used when hiding
> > all the list stuff from Prelude.
>
> This can't be fixed by adding a new class.  

That is what I meant to say ;)

> We can't change the type 
> of Prelude.length, and that includes generalizing it.  

Yes. Prelude an the H98 standard lib are in in need of a large overhaul.

> The only 
> alterative to hiding/qualification is to give our functions different
> names.

...or use qualified import as Henning suggested.

Ben


More information about the Libraries mailing list