RFC: general sequences

Ross Paterson ross at soi.city.ac.uk
Tue May 24 06:39:49 EDT 2005

On Tue, May 24, 2005 at 11:23:40AM +0100, Malcolm Wallace wrote:
> Is Sequence intended to be a symmetric structure, or is it intended
> to be left-biased?  The constructors seem to go for symmetry, but
> many of the other operations are left-biased.  For instance:
>     index
>     adjust
>     update
>     take
>     drop
>     splitAt
> all count from the left end of the Sequence.  Wouldn't it be useful
> to have the equivalent right-biased operations too?
>     indexL	indexR
>     adjustL	adjustR
>     updateL	updateR
>     takeL	takeR
>     dropL	dropR
>     splitAtL	splitAtR

Fair point.  They wouldn't cost much, and the structure should be

> Also, there was debate at the time of the Haskell'98 committee about
> whether the list operations with an Int argument would be better
> taking an Integer.  I believe the consensus was positive towards
> unbounded Integer, but it was important for the standard to be
> backwards compatible, so Int remained.  However, with a new library,
> you have the opportunity to get it right from the start.

Perhaps Integral, like List.generic*, would be a good idea.
The structure uses Ints internally, though.

More information about the Libraries mailing list