[GHC] #13086: (\\) in Data.List uses foldl instead of foldl'

#13086: (\\) in Data.List uses foldl instead of foldl' -------------------------------------+------------------------------------- Reporter: vaibhavsagar | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: | Version: 8.0.1 libraries/base | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The list difference operator `(\\)` is currently defined in terms of `foldl`: https://hackage.haskell.org/package/base-4.9.0.0/docs/src/Data.OldList.html#.... Should it be using `foldl'` instead? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13086 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13086: (\\) in Data.List uses foldl instead of foldl' -------------------------------------+------------------------------------- Reporter: vaibhavsagar | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nomeata): It probably doesn’t make a difference. The accumulator here is of type `[a]` and the function passed to `foldl` is `delete`, which is lazy. So forcing the first element of the list will make `delete` only progress until the next retained element of the list, but the rest will still be a thunk. If you show some benchmarks indicating genuine improvement, we can certainly change this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13086#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC