[Haskell-beginners] Haskell type Array a b

Brandon Allbery allbery.b at gmail.com
Mon May 26 21:37:49 UTC 2014


On Mon, May 26, 2014 at 5:12 PM, Kevin Van Horn <kevin at ksvanhorn.com> wrote:

> I'm looking on the Haskell 98 Report, and the definition of (==) for
> values of type Array a b looks wrong to me. Here is the definition given:
>
>   a == a' = (assocs a == assocs a')
>
> But this fails to account for the array length in each dimension; hence, if
>

Have you tested this? assocs produces a list whose length depends on the
array bounds; (==) on lists accounts for the length. What's left is the
possibility of bounds mismatches, but in that case the index elements of
the list of pairs produced by assocs will not match and they will compare
unequal.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140526/ed8aae4d/attachment.html>


More information about the Beginners mailing list