[GHC] #11049: Allow CallStacks to be hidden or cut

GHC ghc-devs at haskell.org
Wed Nov 4 17:44:35 UTC 2015


#11049: Allow CallStacks to be hidden or cut
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                Owner:  gridaphobe
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11035            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by gridaphobe):

 I think this is an interesting idea, and I think it could be implemented
 entirely in `base` without any additional compiler support. So I'm in
 favor of doing it; we can let users decide if the implementation hiding
 feature is useful.

 The one wrinkle is that this will only work when we have a full call-
 stack, ie every function in the path from `readConfig` to `error`
 '''must''' take a call-stack. Otherwise the chain will be broken
 (remember, call-stacks are just implicit parameters with a special rule
 for function calls) and we'll still see a partial call-stack. For example,
 if I change your example so that `readFile` does not take a call-stack

 {{{#!haskell
 readFile :: FilePath -> IO String
 readFile f = ... error "file not found" ...

 readConfig :: IO Config
 readConfig = do
   s <- let ?callstack = rootCallStack in readFile "config.txt" -- line 42
   return (parseConfig s)
 }}}

 `readConfig` will still print a call-stack that leaks internals if
 `config.txt` does not exist.

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


More information about the ghc-tickets mailing list