Instances of IArray

Albert Lai
16 Feb 2002 01:07:49 -0500

I had looked into the source code of IArray a bit.  Like you have
found, (!) is not a class method.  In fact, none of the claimed class
methods in the doc is a class method, and no class method of IArray is
documented.  Instead, IArray class methods seem to pertain to
implementation details (I mean, "unsafeAt"!), and user operations
such as (!) are constrained polymorphic functions, e.g.,

(!) :: (IArray a e, Ix ix) => a ix e -> ix -> e

>From the user's point of view, there is little difference between a
class method and a class-constrained polymorphic function when the
provided instances are abstract types.  So the documentation is
telling a white lie.  Of course, you see the difference when you
roll your own IArray instance.

I think the white lie is a balance between exposition simplicity
and implementation tuning.