[GHC] #9621: New Data.Foldable methods
#9621: New Data.Foldable methods -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: new Priority: normal | Milestone: 7.10.1 Component: Core Libraries | Version: 7.8.3 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Blocked By: | None/Unknown Related Tickets: #9586 | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- place-holder text; details to follow soon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9621> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9621: New Data.Foldable methods -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: new Priority: normal | Milestone: 7.10.1 Component: Core | Version: 7.8.3 Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: #9586 None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by Herbert Valerio Riedel <hvr@…>): In [changeset:"1812898c0332c6807201938911bb914633267d9d/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="1812898c0332c6807201938911bb914633267d9d" Turn a few existing folds into `Foldable`-methods (#9621) Turn `toList`, `elem`, `sum`, `product`, `maximum`, and `minimum` into `Foldable` methods. This helps avoiding regressions (and semantic differences) while implementing #9586 Reviewed By: austin, dfeuer, ekmett Differential Revision: https://phabricator.haskell.org/D231 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9621#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9621: New Data.Foldable methods -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: new Priority: normal | Milestone: 7.10.1 Component: Core | Version: Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: #9586 None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by hvr): * cc: dfeuer (added) * version: 7.8.3 => Old description:
place-holder text; details to follow soon
New description: See http://thread.gmane.org/gmane.comp.lang.haskell.libraries/22828 The current version of the proposal at time of writing:
Add the following to `Foldable`:
- `length` — often stored as a separate field for //O(1)// access - `null` — called very often and slightly faster than `foldr (\_ _ -> False) True` for some containers - `toList` — may be the identity or nearly so, and this fact may not be statically available to the foldr/id rule - `sum`, `product` — may be cached internally in tree nodes for fast update, giving //O(1)// access; may be calculated in parallel. - `maximum`, `minimum` — //O(n)// for a search tree; //O(1)// for a finger tree. - `elem` — //O(log n)// for search trees; likely better for hash tables and such.
**Don't** add anything to `Traversable`, because `scanl1` and `scanr1` are not worth the extra dictionary weight.
-- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9621#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9621: New Data.Foldable methods -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: new Priority: normal | Milestone: 7.10.1 Component: Core | Version: Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: #9586 None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by Herbert Valerio Riedel <hvr@…>): In [changeset:"e5cca4ab246ca2d1ecdd7c39eefd3157547cb6aa/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="e5cca4ab246ca2d1ecdd7c39eefd3157547cb6aa" Extend `Foldable` class with `length` and `null` methods This completes the `Foldable` class by two important operations which this way can be optimised for the underlying structure more easily. A minor fix for the `containers` submodule was needed to due name clash Addresses #9621 Reviewed By: ekmett, dfeuer, austin Differential Revision: https://phabricator.haskell.org/D250 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9621#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9621: New Data.Foldable methods -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: closed Priority: normal | Milestone: 7.10.1 Component: Core | Version: Libraries | Keywords: Resolution: fixed | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: #9586 None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * cc: core-libraries-committee@… (added) * status: new => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9621#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC