
#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