Apologies if this is an issue which has been debated before - I'm a
relative newcomer to Haskell.

The specification of arrays allows for indices for which the
corresponding element in the array is undefined. There are also
functions which get all of the indices, elements or associations in the
array. They appear (in hugs, at least) to deliver all the members of the
array whether defined or not. So for example if I create an array with
foo = array (1,3) [(1,"one"),(3,"three")]
then indices foo is [1,2,3], and both elems foo and assocs foo blow up
if I try to (say) use trace to look at the results.

Perhaps it would be useful to have versions of indices, elems and assocs
which deliver just the defined members, or (for elems and assocs) use
Maybe's to indicate definedness. Is this sensible/desireable?

-- David Elworthy

_______________________________________________________________________
David Elworthy <[EMAIL PROTECTED]>
Canon Research Centre Europe Ltd., Guildford, Surrey, UK
URL: http://www.cre.canon.co.uk/
Phone: +44 1483 448844; Fax: +44 1483 448845


Reply via email to