[GHC] #14755: Allow putting SCC annotations on class instance methods

#14755: Allow putting SCC annotations on class instance methods -------------------------------------+------------------------------------- Reporter: niteria | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: Component: Profiling | Version: 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: -------------------------------------+------------------------------------- Perhaps there's a way to do this that I don't know about. Here's a file: {{{ module Test where class C a where foo :: a -> String instance C Int where -- this would be a parse error: {-# SCC foo #-} foo a = show a }}} I want to put a cost center on `foo`. Like mentioned in the comment, doing that in the obvious way is a parse error. Interestingly `-fprof-auto-top` puts a cost center on `foo`. This came up when debugging #14637. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14755 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14755: Allow putting SCC annotations on class instance methods -------------------------------------+------------------------------------- Reporter: niteria | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Profiling | Version: 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 osa1): Do you not get the same effect with `-fprof-auto-top` if you do `foo a = {-# SCC foo #-} show a`? I'm also a bit surprised that `-fprof-auto-top` adds a SCC to this `foo`. Apparently typeclass methods are considered as top level. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14755#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14755: Allow putting SCC annotations on class instance methods -------------------------------------+------------------------------------- Reporter: niteria | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Profiling | Version: 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 niteria):
Do you not get the same effect with -fprof-auto-top if you do foo a = {-# SCC foo #-} show a?
Yes, that works, but if `foo` does pattern matching on the parameters, you need to put multiple `SCCs` or refactor the code. You can also make `fooHelper` that's a top level function and just `foo = fooHelper`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14755#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14755: Allow putting SCC annotations on class instance methods -------------------------------------+------------------------------------- Reporter: niteria | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Profiling | Version: 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 osa1): Right.. I made some progress on supporting `SCC`s in more places some time ago: https://github.com/ghc/ghc/commit/98b2c508 it shouldn't be too hard to make it possible to use in this context. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14755#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC