[GHC] #9510: Prelude.!! is not a good consumer
#9510: Prelude.!! is not a good consumer -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.8.3 Keywords: fusion | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Runtime Blocked By: | performance bug Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- I think we can probably do something like this, but I haven't checked the Core yet: {{{#!hs xs !! n | n < 0 = error "Prelude.!!: Negative index" | otherwise = foldr go (error "Prelude.!!: index too large or list empty") xs n where go x _ 0 = x go _ f k = f (k - 1) }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9510> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9510: Prelude.!! is not a good consumer -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: | Version: 7.8.3 libraries/base | Keywords: fusion Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Runtime | Related Tickets: performance bug | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by dfeuer): Note that, like the new `last`-as-`foldl`, this almost certainly won't be able to unbox the list elements, for the same reason. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9510#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9510: Prelude.!! is not a good consumer -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: ekmett Type: bug | Status: patch Priority: normal | Milestone: Component: Core | Version: 7.8.3 Libraries | Keywords: fusion Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Runtime | Related Tickets: performance bug | Test Case: | Blocking: | Differential Revisions: Phab:D380 | -------------------------------------+------------------------------------- Changes (by dfeuer): * cc: core-libraries-committee@… (added) * status: new => patch * differential: => Phab:D380 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9510#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9510: Prelude.!! is not a good consumer -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: ekmett Type: bug | Status: patch Priority: normal | Milestone: Component: Core | Version: 7.8.3 Libraries | Keywords: fusion Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Runtime | Related Tickets: performance bug | Test Case: | Blocking: | Differential Revisions: Phab:D380 | -------------------------------------+------------------------------------- Comment (by Herbert Valerio Riedel <hvr@…>): In [changeset:"75979f3661ff16ec44528a23005ac1be2b9683fe/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="75979f3661ff16ec44528a23005ac1be2b9683fe" base: Refactor/clean-up *List modules This gets rid of all hand-unboxing in `GHC.List` and moves `Foldable` requirements from `Data.OldList` into `GHC.List` (preparatory work for addressing #9716). Specifically, this moves the definition of `maximum`, `minimum`, `foldl'`, `foldl1`, `foldl1'`, `sum`, and `product` into `GHC.List` (which now needs to import `GHC.Num`) Make `take`, `drop`, `length`, and `!!` generally saner (see also #9510) Performance overall seems minimally affected. Some things go up; some things go down; nothing moves horribly much. The code is much easier to read. Differential Revision: https://phabricator.haskell.org/D380 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9510#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9510: Prelude.!! is not a good consumer -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: ekmett Type: bug | Status: closed Priority: normal | Milestone: 7.10.1 Component: Core | Version: 7.8.3 Libraries | Keywords: fusion Resolution: fixed | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Runtime | Related Tickets: performance bug | Test Case: | Blocking: | Differential Revisions: Phab:D380 | -------------------------------------+------------------------------------- Changes (by dfeuer): * status: patch => closed * resolution: => fixed * milestone: => 7.10.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9510#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC