cvs commit: fptools/libraries/base/GHC Arr.lhs

Ross Paterson ross at soi.city.ac.uk
Wed Apr 13 06:59:26 EDT 2005


On Wed, Apr 13, 2005 at 11:35:42AM +0100, Simon Marlow wrote:
> It's because unsafeRangeSize is supposed to have the same meaning as
> rangeSize.  If someone defines an instance of Ix and overrides
> rangeSize, then unsafeRangeSize should continue to behave like rangeSize
> (remember, unsafeRangeSize isn't part of the exposed interface of
> Data.Ix, so clients of that interface can only define rangeSize).

The specification of rangeSize (Report + Erratum):

	map index (range (l,u)) == [0..rangeSize (l,u) - 1]

constrains it (and unsafeRangeSize) fairly closely.  The text seems to
imply that l and u are the first and last elements of range (l,u), i.e.

	index (l,u) l == 0
	index (l,u) u == rangeSize (l,u) - 1

which would make the default definition correct, and seems to imply that
it doesn't need to be a member function.


More information about the Cvs-libraries mailing list