[Haskell-beginners] Haskell type Array a b

Norbert Melzer timmelzer at gmail.com
Mon May 26 23:01:31 UTC 2014


The arrays he gave as an example had all At least one dimension equal to 0.
So assocs would produce an empty list as far as I remember, so the three
arrays would be considered to be equal indeed. It's a pity I can't check
that right now, I'm on mobile...
Am 26.05.2014 23:37 schrieb "Brandon Allbery" <allbery.b at gmail.com>:

> 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
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140527/7ced2206/attachment.html>


More information about the Beginners mailing list