Here are three comments directed particularly at Haskell 1.3 people, but
obviously open to general feedback.

1. We should get rid of Assoc.

When explaining my programs to other people I find this is a point of
confusion. Imagine exaplaining array construction, "When I define an array,
the comprehension produces a list of index/value pairs, only they are not
written as pairs--these's this special type called Assoc. Oh, and don't be
confused by :=. That's not assignment. It is an infix pairing operator."
All of this is entirely unnecessary. Pairs have been used in maths for
decades to represent exactly this sort of thing. I simply do not believe
that [Assoc a b] provides me with any better information than [(a,b)].
Worse, I often find myself having to redefine standard pair functions on
elements of Assoc.

2. Arrays should be lazier.

I'm expecting Lennart to agree with me here as LML has the Right Thing. I
am convinced that there is no semantic problem with this, and I think that
even Simon isn't horrified at the implementation implications. The ability
to define arrays by self reference is just as important as it is for lists.
I am assuming that the fact that lazy indexes provide a better match with
laziness elsewhere is clear, but I am willing to expand on this point if
someone wants.

3. AccumArray should mimic foldr, not foldl.

This is tied up with the last point. The only advantage I can see with the
present scheme would be if the array element could be used as the
accumulator while the array was under construction. However, as arrays are
non-strict in their *elements* this seems to be of no benefit. It seems to
me highly sensible that the structure of the computation at each point
should reflect the structure of the input sequence (i.e. the elements are
in the same order). Furthermore, if a lazy operation is used (such as (:))
then the result becomes available early (assuming point 2. above).

John.


Reply via email to