diff options
author | David Feuer <David.Feuer@gmail.com> | 2014-11-13 09:10:57 +0100 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2014-11-13 09:16:49 +0100 |
commit | 212a350547e950cc5be465a3d76e346ef14bf2ab (patch) | |
tree | 61453d586c8ed748522fa4c62b51a0fbcf01ba6a /compiler | |
parent | c016e6f74e26708586352fec657798f271b0675b (diff) | |
download | haskell-212a350547e950cc5be465a3d76e346ef14bf2ab.tar.gz |
Improve `Foldable` instance for `Array`
Previously, `Array`s were simply converted to lists, and the list
methods used. That works acceptably well for `foldr` and `foldr1`, but
not so sensibly for most other things. Left folds ended up "twisted" the
way they are for lists, leading to surprising performance
characteristics.
Moreover, this implements `length` and `null` so they check the array
size directly.
Finally, a test is added to the testsuite ensuring the overridden
`Foldable` methods agree with their expected default semantics.
Addresses #9763
Reviewed By: hvr, austin
Differential Revision: https://phabricator.haskell.org/D459
Diffstat (limited to 'compiler')
0 files changed, 0 insertions, 0 deletions