H98: Ix class

Jan-Willem Maessen jmaessen@alum.mit.edu
Tue, 11 Sep 2001 09:16:11 -0400


Simon PJ asks:
> Does anyone want to argue that having Ord as a superclass of Ix is So
> Bad
> that it Absolutely Must Be Removed?

Nope.  If there's no natural ordering I expect the derived ordering
will be used in practice.  Occasionally messy, but it keeps the old
code going.

Just to clarify, do we still require identities (1) and (3) below
(pasted from the Library report and numbered)?  That is, is range
obliged to yield its results in strict index order?  [This rules out
Ix instances that do, e.g., blocked iteration unless the array itself
is also re-blocked.  Reblocking the array itself is arguably a good
idea, but may not be what we expect...]

1)   range (l,u) !! index (l,u) i == i   -- when i is in range
2)   inRange (l,u) i == i `elem` range (l,u)
3)   map index (range (l,u))      == [0..rangeSize (l,u)]

-Jan-Willem Maessen
Eager Haskell Project
jmaessen@mit.edu