Data.Sequence 'index' documentation may be incorrect.

Ross Paterson ross at soi.city.ac.uk
Wed Oct 28 06:58:57 EDT 2009


On Wed, Oct 28, 2009 at 01:36:32AM -0400, iæfai wrote:
> In the documentation for Data.Sequence.index: index :: Seq a -> Int -> a O(log
> (min(i,n-i))). The element at the specified position, which should be a
> positive integer less than the size of the sequence. If the position is out of
> range, index fails with an error. == 'a positive integer' refers to an number
> in the set of {1, 2, 3,  } but through some code discovered that what it really
> means is a non-negative integer, {0, 1, 2,  } Although it would be more
> immediately known if it just said it was a 0 based index.

Changed to

-- | /O(log(min(i,n-i)))/. The element at the specified position,
-- counting from 0.  The argument should thus be a non-negative
-- integer less than the size of the sequence.
-- If the position is out of range, 'index' fails with an error.

Thanks for the report.


More information about the Libraries mailing list