[GHC] #9763: Implement Foldable methods for Array directly
#9763: Implement Foldable methods for Array directly -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: task | Status: new Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.9 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Blocked By: | None/Unknown Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Currently, they're implemented via conversion to lists. This works out sanely for `foldr` and `foldr1`, after some transformations, but it's rather less sane for left folds. Left folds end up "twisted" like their list counterparts, giving potentially surprising performance characteristics. For `Array`, left and right folds can reasonably be expected to be symmetrical. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9763> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9763: Implement Foldable methods for Array directly -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: task | Status: patch Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.9 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D428 | -------------------------------------+------------------------------------- Changes (by dfeuer): * status: new => patch * differential: => Phab:D428 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9763#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#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:D428 | -------------------------------------+------------------------------------- Changes (by thomie): * cc: core-libraries-committee@… (added) * component: Compiler => Core Libraries -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9763#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#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 | -------------------------------------+------------------------------------- Changes (by dfeuer): * differential: Phab:D428 => Phab:D459 Comment: The patch now includes tests, as requested. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9763#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#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
#9763: Implement Foldable methods for Array directly -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: task | Status: closed Priority: normal | Milestone: 7.10.1 Component: Core | Version: 7.9 Libraries | Keywords: Resolution: fixed | 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 | -------------------------------------+------------------------------------- Changes (by thomie): * status: patch => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9763#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC