[GHC] #11686: implicit call stacks should provide a way to get the calling function's name

#11686: implicit call stacks should provide a way to get the calling function's name -------------------------------------+------------------------------------- Reporter: elaforge | Owner: Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 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: -------------------------------------+------------------------------------- With implicit call stacks we can get the calling SrcPos and the called function's name, but not the caller function's name. E.g.: {{{#!hs {-# LANGUAGE ImplicitParams, ConstraintKinds #-} import qualified GHC.Stack as Stack caller :: IO () caller = callee 10 where callee :: (?stack :: Stack.CallStack) => Int -> IO () callee _n = mapM_ print (Stack.getCallStack ?stack) }}} Gives {{{ ("?stack",SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "T.hs", srcLocStartLine = 9, srcLocStartCol = 36, srcLocEndLine = 9, srcLocEndCol = 42}) ("callee",SrcLoc {srcLocPackage = "main", srcLocModule = "Main", srcLocFile = "T.hs", srcLocStartLine = 6, srcLocStartCol = 23, srcLocEndLine = 6, srcLocEndCol = 29}) }}} It would be nice to get the name "caller" as well. It's too bad getCallStack returns pairs instead of an abstract type like Frame. Perhaps a separate Stack.getFrames could do that while getCallStack continues to return pairs for compatibility. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11686 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11686: implicit call stacks should provide a way to get the calling function's name -------------------------------------+------------------------------------- Reporter: elaforge | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 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: | -------------------------------------+------------------------------------- Changes (by bgamari): * cc: gridaphobe (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11686#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11686: implicit call stacks should provide a way to get the calling function's name -------------------------------------+------------------------------------- Reporter: elaforge | Owner: gridaphobe Type: feature request | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 7.10.3 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: | -------------------------------------+------------------------------------- Changes (by gridaphobe): * owner: => gridaphobe * milestone: => 8.2.1 Comment: Thanks for the report. I like the suggestion to return an abstract Frame type. I'm not sure I'll have time to work on this before 8.0 is released, so I'm tentatively setting it for 8.2. The main issue will probably be that adding the caller strings will exacerbate #10844, so I should finish addressing that ticket first. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11686#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC