[GHC] #9763: Implement Foldable methods for Array directly

GHC ghc-devs at haskell.org
Thu Nov 13 08:17:54 UTC 2014


#9763: Implement Foldable methods for Array directly
-------------------------------------+-------------------------------------
              Reporter:  dfeuer      |            Owner:  dfeuer
                  Type:  task        |           Status:  patch
              Priority:  normal      |        Milestone:  7.10.1
             Component:  Core        |          Version:  7.9
  Libraries                          |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:              |  Related Tickets:
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:  Phab:D459   |
-------------------------------------+-------------------------------------

Comment (by Herbert Valerio Riedel <hvr@…>):

 In [changeset:"212a350547e950cc5be465a3d76e346ef14bf2ab/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="212a350547e950cc5be465a3d76e346ef14bf2ab"
 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
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9763#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list