[GHC] #14911: Offer a way to augment call stacks

GHC ghc-devs at haskell.org
Mon Mar 12 08:18:41 UTC 2018


#14911: Offer a way to augment call stacks
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Core Libraries    |              Version:  8.4.1
      Resolution:                    |             Keywords:  CallStacks
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 dfeuer):

 Here's a very rough draft. This can be written without modifying the
 `CallStack` type, but I imagine it would be better to modify that.

 {{{#!hs
 extraCS :: HasCallStack
         => String
         -> (HasCallStack => a)
         -> a
 extraCS s a =
   let cs = ?callStack
   in
     let ?callStack = case cs of
            EmptyCallStack -> EmptyCallStack
            PushCallStack x y z -> PushCallStack (x ++ " (" ++ s ++ ")") y
 z
            q@(FreezeCallStack _) -> q
     in a
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14911#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list