
Fergus Henderson
I tried building this with hat ("hmake -hat Foo"), running it ("./Foo") and then using hat-stack ("hat-stack Foo"). But hat-stack reported no useful information.
hat-stack is kind of obsolete. At least, it has had no maintenance in a long time, partly because it is written in C rather than Haskell, but mainly because hat-trail can do everything hat-stack can, but better. Perhaps one day we will rewrite hat-stack in Haskell as a cut-down version of hat-trail. However, in this instance, I suspect you got no useful information from hat-stack for exactly the same reason you had trouble with hat-trail (see below).
I also tried using hat-trail, but I couldn't get any useful information out of that either.
The reason for this is that your program exclusively uses CAFs (constants). A CAF does not have a parent recorded in the trace, essentially because the CAF could be called many times, and we have no mechanism for recording multiple parents of the constant. Nevertheless, hat-trail tells me that the message "in h" came from: <- {?} <- error "in h" <- h which is accurate, and only reflects the trivial nature of the program. If you re-cast your program to make f, g, and h into functions, f :: () -> Int f () = g () g () = h () h () = error "in h" main = do { putStrLn "in main"; print (f ()) } you will see a better result: <- {?} <- error "in h" <- h () <- g () <- f () <- main and each of those expressions has an associated source position that you can view with the :source command (for usage), or :Source (for definition).
Also, hat-trail failed to properly restore the tty state after ":q".
This has been reported by several people, but I can't reproduce it on my gnome-terminal. What terminal emulation are you using? Can you tell me the results of 'stty' on a normal terminal window, and also on a corrupted window? Or if the latter is not possible, on a corrupted window after you have reset it in the gentlest way you know? Regards, Malcolm