Hello Simon, Monday, May 23, 2005, 6:46:14 PM, you wrote:
SPJ> | head (x:xs) = x SPJ> | head [] = superError "head []" SPJ> | SPJ> | which will print: "Error: head [] in Module.hs:155" SPJ> A difficulty is that the caller of 'head' might itself be called from SPJ> somewhere else: you are right. i forget that it needs run-time support SPJ> It's all very like cost-centre stacks, which is why GHC provides the -xc SPJ> option when you are profiling. I think that give you what you want --- SPJ> but you have to compile your program profiled. i never used -prof, so i can't comment this. btw, -prof is not compatible with -threaded, at least in my distribution (i guess that it may be just lack of appropriately compiled libraries) SPJ> Another take on this is that you want an implicit parameter SPJ> head :: (%loc :: Location) => [a] -> a SPJ> so that 'head' can report %loc when it fails. Now you'd need to give SPJ> rules to say where %loc is bound. It'd be a pretty magic kind of SPJ> implicit parameter. Or should it be a stack of locations? of course, stack! it's look very beatiful. calling stack in lazy language - that will be amazing! :-) i foresee that this implicit parameter, if it will be added to GHC, may also be used for other debugging purposes but it's not obvious which calls we must keep in this stack. to be exact, it's possible to save tail-recursed calls while omitting indirect-recursive calls (which also will be tail-recursive)? -- Best regards, Bulat mailto:[EMAIL PROTECTED] _______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs