Re: [GHC] #960: Lexical call site string
#960: Lexical call site string ---+ Reporter: paul@… |Owner: Type: feature request | Status: new Priority: normal |Milestone: _|_ Component: Compiler| Version: 6.6 Keywords: | Testcase: N/A Blockedby: | Difficulty: Unknown Os: Unknown/Multiple| Blocking: Architecture: Unknown/Multiple| Failure: None/Unknown ---+ Changes (by batterseapower): * failure: = None/Unknown Comment: See also #3693 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/960#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #960: Lexical call site string
#960: Lexical call site string ---+ Reporter: p...@cogito.org.uk |Owner: Type: feature request | Status: new Priority: normal |Milestone: _|_ Component: Compiler| Version: 6.6 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: N/A | Os: Unknown/Multiple Architecture: Unknown/Multiple| ---+ Changes (by PHO): * cc: p...@cielonegro.org (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/960#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #960: Lexical call site string
#960: Lexical call site string +--- Reporter: [EMAIL PROTECTED] | Owner: Type: feature request | Status: new Priority: normal | Milestone: _|_ Component: Compiler|Version: 6.6 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: N/A | Architecture: Unknown Os: Unknown | +--- Comment (by igloo): See also #1441 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/960#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #960: Lexical call site string
#960: Lexical call site string +--- Reporter: [EMAIL PROTECTED] | Owner: Type: feature request | Status: new Priority: normal | Milestone: _|_ Component: Compiler|Version: 6.6 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: N/A | Architecture: Unknown Os: Unknown | +--- Changes (by Isaac Dupree): * cc: [EMAIL PROTECTED] (added) Comment: `undefined` could use a hack like `assert` currently does, but as soon as we want to start annotating things like `fromJust`, we'll need somewhat of a general mechanism. Potentially ''so'' worth it though. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/960#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #960: Lexical call site string
#960: Lexical call site string +--- Reporter: [EMAIL PROTECTED] | Owner: Type: feature request | Status: new Priority: normal | Milestone: _|_ Component: Compiler|Version: 6.6 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: N/A | Architecture: Unknown Os: Unknown | +--- Changes (by igloo): * milestone: = _|_ * testcase: = N/A -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/960 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #960: Lexical call site string
#960: Lexical call site string +--- Reporter: [EMAIL PROTECTED] | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler|Version: 6.6 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Unknown | +--- Comment (by [EMAIL PROTECTED]): It occurs to me that there may be a relatively simple src-src transformation that could annotate every failing expression with its lexical callsite. Much in the way that hpc uses a src-src transformation to annotate expressions with information about whether (and how often) they get called. One of the cool things about the hpc transformation (in contrast to the more complex src-src transformation done by Hat) is that it does not change the types, so you can freely mix annotated code with plain unannotated code (e.g. from libraries). I wonder whether you would need to identify possibly failing expressions - with something like the Catch analysis tool? Or would it be sufficient as a first cut to just assume that all expressions can fail? -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/960 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #960: Lexical call site string
#960: Lexical call site string +--- Reporter: [EMAIL PROTECTED] | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler|Version: 6.6 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Unknown | +--- Comment (by simonpj): You're asking for a function; but what is this function called, and what is its type? In general it's not clear (to me) exactly what you are proposing; or whether it is implementable. Clarification welcome! -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/960 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #960: Lexical call site string
#960: Lexical call site string +--- Reporter: [EMAIL PROTECTED] | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler|Version: 6.6 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Unknown | +--- Comment (by simonpj): A neat way to do this might be to extend Template Haskell slightly, to provide {{{ currentLocation :: Q (Filepath, Int) }}} giving the filename and location of the current splice. (This is rather similar to the existing Template Haskell function [http://www.haskell.org/ghc/docs/latest/html/libraries/template-haskell /Language-Haskell-TH-Syntax.html#v%3AcurrentModule currentModule].) Then you could define {{{ callSite :: ExpQ callSite = do { (f,n) - currentLocation ; return (LitE (StringL (f ++ : ++ show n))) } }}} And use it thus: {{{ error (woggle at ++ $callSite) }}} Since the Template Haskell splice `$callSite` is a TH splice, it's ok for it to grab contextual information. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/960 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #960: Lexical call site string
#960: Lexical call site string +--- Reporter: [EMAIL PROTECTED] | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler|Version: 6.6 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Unknown | +--- Comment (by pauljohnson): I haven't studied Template Haskell, but won't that just give the location of the error call? I want the place the enclosing function was called from. So if head calls error I want to see what called head. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/960 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
[GHC] #960: Lexical call site string
#960: Lexical call site string ---+ Reporter: [EMAIL PROTECTED] | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler| Version: 6.6 Severity: normal |Keywords: Difficulty: Unknown |Testcase: Architecture: Unknown | Os: Unknown ---+ A function that returns the lexical call site of the current function when an exception occurs. I'm thinking primarily of head [], but the same principle would apply to other functions. A dynamic traceback is not necessarily possible in a lazy language, but when head gets called on an empty list there must be somewhere in the program that actually said head, even if it was not evaluated at the time or included in a closure or something. That way when I get a head: empty list I don't need to grep my program for head calls: I know where head was called from and can start looking there. Examples: * If I just have a function foo = head then it will report that the caller was foo. * If I have a function bar x y = ... and subsequntly say baz x = bar (x * 2) then an exception in bar will report the caller as baz. I know there is a -x profiler option to get a sort of dynamic traceback, but I find it frequently just tells me the error is in CAF.List, which isn't very informative. I'm guessing at a difficulty of 1 week as I don't know the GHC internals. I'm guessing that the call site is going to have to be a hidden parameter passed in to each function call, or alternatively hard-coded when a function is in-lined. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/960 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs