
#15131: Speed up certain Foldable NonEmpty methods -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4677 Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): GHC isn't clever enough to reassociate a recursively calculated sum, no. The `foldl'` definition you give ends up looking just the same as the default. As for `sum`, etc., I don't really think we should write worse code today because maybe some year the definition for lists will improve while the default definition doesn't. You can push for those changes separately, and in due course we can adjust this instance again if necessary. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15131#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler