
Hello all, I'm doing my dissertation on writing a GUI for hat, and Neil Mitchell suggested I send a mail saying what i was planning to see if you guys had any good ideas or comments. This is the proposal: The problem Hat provides a easy way to generate a trace, and various tools have been developed to examine the traces produced by it. However, these tools have two main flaws: They are hard to learn and use and they are not linked together. Ideally we would like hat to be as easy to use as possible. This way it can both be used to debug real programs by Haskell programmers, but can be used as a teaching tool for beginners, so they can see how lazy evaluation works and find simple bugs when they write their first programs. The solution Write a graphical user interface to Hat. A clickable GUI will be easier to use than a ncurses GUI, and will seem easier to use. The GUI will provide the same functionality as the hat tools do already, but it will be easier to use. This will be done by separating out the current user interface from the functionality as much as possible, then making the functionality into a library. As part of this, I will try and upgrade the tools to use the new tracing library written by Tom Shackell. The GUI's will be implemented in GTK2HS . It will consist of a Window with tabs for each tool. Neil Mitchell has already constructed a GUI, and I plan to use this as a starting point. The tools that will be usable though the GUI will be: Search This will let the user search though all the functions called, and see that function.s inputs and output. The UI will be based on that of JuK, with searching using haskell.s pattern matching syntax. Monad A step over debugger for do blocks. This will be similar to normal debuggers Stack. When loading a a trace that has terminated with an error, the GUI will show a listing of the last functions called and their inputs and outputs. It will collapse any loops. Cover It will use hs-colour to try and show which functions are being used for a set of inputs. If the new tracing library is used, and it supports taking the union of traces, this will be used to show coverage from lots of traces. This can be tied into quickcheck. Ethereal bit. Ethereal is a tool for examining network traffic, and my plan is to . borrow from it's "follow TCP stream" feature, which shows you all the traffic in a stream, and lets you see messages and replies. It will show text moving in and out of handles, and display the logical time between messages. Display bit. This will allow the user to see how redexes happen and allow the use to see laziness in action. This will be based on hat-amin. It is dependent on writing a good graph drawing function. algorithmic This will be a normal algorithmic debugger, though I haven.t thought of how it will work in a GUI. Any suggestions, comments? Pete

Hi Pete,
This will let the user search though all the functions called, and see that function.s inputs and output. The UI will be based on that of JuK, with searching using haskell.s pattern matching syntax. Is this not just hat-observe?
A step over debugger for do blocks. This will be similar to normal debuggers Is this intended to be a brand new debugging tool?
Ethereal is a tool for examining network traffic, and my plan is to . borrow from it's "follow TCP stream" feature, which shows you all the traffic in a stream, and lets you see messages and replies. It will show text moving in and out of handles, and display the logical time between messages. So will this tool be an IO monitor? i.e. seeing all external actions which occur, and in what order?
This will allow the user to see how redexes happen and allow the use to see laziness in action. This will be based on hat-amin. It is dependent on writing a good graph drawing function. I think this will probably be more like a tree than a graph? If so its not that hard to do, lots of algorithms exist and they are pretty easy.
algorithmic
This will be a normal algorithmic debugger, though I haven.t thought of how it will work in a GUI. I had a design for this, basically a list of alternating question answer lines:
sort [] = [] <yes> <no> insert [] = [] <yes> <no> When a user clicks on a yes or a no which is at the bottom line, it generates a new question, when a user clicks on a yes or a no higher up, and different from the previous answer, it deletes the list below that point and generates a new question. This lets the user see their "choice history", and change it at any time, will being an essentially linear process for those people who don't want any additional complexity.
Any suggestions, comments? black-hat, hat-nonterm? Both are pretty trivial to integrate into a GUI, so it shouldn't be more than a few hours work. I would actually suggest doing these two first, just to figure out how to attack this on an easy problem.
One general point is that you seem to be proposing some new tools here? ethereal, monad, redex. Implementing a new tool is likely to take a lot longer than just guifying an existing one. You also might be biting off more than you can chew with that many new tools. (of course, if you can do it all, thats great!) I am looking forward to using hat-gui as a real debugging tool! Thanks, Neil

Hi Pete, great to see another person working on a GUI for Hat. I'd be a bit more careful with the problem description. Many of the tools are linked together, you can call one from the other. This is actually a very modular approach. Second, it is not immediate that a GUI makes a tool easier to learn or to use. The idea of a tool still needs to be understood and in how far is a GUI easier to use? Nonetheless, there is certainly the problem that the current text tools don't work under Windows and a GUI is more attractive for many users. And I'm sure mouse input and graphics can make a tool easier to use, but that needs more thought. You list a lot of tools; several of which seem to be new. I'd concentrate on one or very few. Getting one that works really well is better than several half-working. Still, as Neil said, first providing a GUI for a simple existing one may be good practice to start going. Much success, ciao, Olaf Peter Nuttall wrote:
Hello all,
I'm doing my dissertation on writing a GUI for hat, and Neil Mitchell suggested I send a mail saying what i was planning to see if you guys had any good ideas or comments. This is the proposal:
The problem
Hat provides a easy way to generate a trace, and various tools have been developed to examine the traces produced by it. However, these tools have two main flaws: They are hard to learn and use and they are not linked together. Ideally we would like hat to be as easy to use as possible. This way it can both be used to debug real programs by Haskell programmers, but can be used as a teaching tool for beginners, so they can see how lazy evaluation works and find simple bugs when they write their first programs.
The solution
Write a graphical user interface to Hat. A clickable GUI will be easier to use than a ncurses GUI, and will seem easier to use. The GUI will provide the same functionality as the hat tools do already, but it will be easier to use. This will be done by separating out the current user interface from the functionality as much as possible, then making the functionality into a library. As part of this, I will try and upgrade the tools to use the new tracing library written by Tom Shackell.
The GUI's will be implemented in GTK2HS . It will consist of a Window with tabs for each tool. Neil Mitchell has already constructed a GUI, and I plan to use this as a starting point.
The tools that will be usable though the GUI will be:
Search
This will let the user search though all the functions called, and see that function.s inputs and output. The UI will be based on that of JuK, with searching using haskell.s pattern matching syntax.
Monad
A step over debugger for do blocks. This will be similar to normal debuggers
Stack.
When loading a a trace that has terminated with an error, the GUI will show a listing of the last functions called and their inputs and outputs. It will collapse any loops.
Cover
It will use hs-colour to try and show which functions are being used for a set of inputs. If the new tracing library is used, and it supports taking the union of traces, this will be used to show coverage from lots of traces. This can be tied into quickcheck.
Ethereal bit.
Ethereal is a tool for examining network traffic, and my plan is to . borrow from it's "follow TCP stream" feature, which shows you all the traffic in a stream, and lets you see messages and replies. It will show text moving in and out of handles, and display the logical time between messages.
Display bit.
This will allow the user to see how redexes happen and allow the use to see laziness in action. This will be based on hat-amin. It is dependent on writing a good graph drawing function.
algorithmic
This will be a normal algorithmic debugger, though I haven.t thought of how it will work in a GUI.
Any suggestions, comments?
Pete
_______________________________________________ Hat mailing list Hat@haskell.org http://www.haskell.org/mailman/listinfo/hat

On 28 Jul 2006, at 17:59, Peter Nuttall wrote:
Hello all,
I'm doing my dissertation on writing a GUI for hat, and Neil Mitchell suggested I send a mail saying what i was planning to see if you guys had any good ideas or comments. This is the proposal:
The problem
Hat provides a easy way to generate a trace, and various tools have been developed to examine the traces produced by it. However, these tools have two main flaws: They are hard to learn and use and they are not linked together. Ideally we would like hat to be as easy to use as possible. This way it can both be used to debug real programs by Haskell programmers, but can be used as a teaching tool for beginners, so they can see how lazy evaluation works and find simple bugs when they write their first programs.
The solution
Write a graphical user interface to Hat. A clickable GUI will be easier to use than a ncurses GUI, and will seem easier to use. The GUI will provide the same functionality as the hat tools do already, but it will be easier to use. This will be done by separating out the current user interface from the functionality as much as possible, then making the functionality into a library. As part of this, I will try and upgrade the tools to use the new tracing library written by Tom Shackell.
The GUI's will be implemented in GTK2HS . It will consist of a Window with tabs for each tool. Neil Mitchell has already constructed a GUI, and I plan to use this as a starting point.
The tools that will be usable though the GUI will be:
Search
This will let the user search though all the functions called, and see that function.s inputs and output. The UI will be based on that of JuK, with searching using haskell.s pattern matching syntax. As Neil said, this sounds a lot like hat-observe
Monad
A step over debugger for do blocks. This will be similar to normal debuggers An excellent idea, but I think you might have a few problems, I've had a look at trying to deal with IO actions a bit better and found that (actually quite reasonably) the trace doesn't actually have any information on what IO happened. The trace represents the purely functional part of the computation, so all you will see is that something evaluated to an IO action.
What I had considered doing is essentially emulating the IO actions in the tool, this is limited in the sense of it supports only those actions you code into the tool, but it is at least a solution. I'd be interested to see what you come up with here.
Stack.
When loading a a trace that has terminated with an error, the GUI will show a listing of the last functions called and their inputs and outputs. It will collapse any loops. Something similar to hat-stack?
Cover
It will use hs-colour to try and show which functions are being used for a set of inputs. If the new tracing library is used, and it supports taking the union of traces, this will be used to show coverage from lots of traces. This can be tied into quickcheck. Excellent, that's a really useful tool for me. You might find some useful code in hat-delta and in hat-cover. Hat-cover contains code that will give you full coverage for a call, while hat-delta contains code that will generate the coverage in the top level function call.
Ethereal bit.
Ethereal is a tool for examining network traffic, and my plan is to . borrow from it's "follow TCP stream" feature, which shows you all the traffic in a stream, and lets you see messages and replies. It will show text moving in and out of handles, and display the logical time between messages. Interesting - I'd like to see this integrated with your IO monad tool.
Display bit.
This will allow the user to see how redexes happen and allow the use to see laziness in action. This will be based on hat-amin. It is dependent on writing a good graph drawing function. So you want to do hat-anim but rather than showing the redex you want to show the current heap state? That sounds fun, but probably complex.
algorithmic
This will be a normal algorithmic debugger, though I haven.t thought of how it will work in a GUI. I'd thought about doing it the way neil suggests, but there are other
Straight off the top of my head for graph drawing, you might want to use the NodeExp library to generate the full trace, and then apply various transforms to the graphs to get the various steps (there's a singleStepEval function in there that performs a single step of the evaluation). You can then shove that output into pretty-hat (it has library calls) to generate dot files, stick that into dot, and display the pdf it renders for you. options. Look at hat-explore... perhaps a version of that that shows you the EDT, and allows you to click on nodes and mark them as correct or incorrect? I hope that lot's useful to you A final suggestion, at least the tools I've written recently, I've tried to keep pretty modular with thoughts of adding a GUI later, so you can probably use a lot of the NodeExp, HatAnim, Slice, PrettyHat, and HatDelta code. I've found that some of the older code is pretty modular, but some of it is fairly hard to navigate, so there may be more pickings in there to integrate. In short, I'm saying try not to reinvent the wheel too much, there's a lot of good code in there. Bob

Peter, Pleased to hear that you are planning to work towards some advances in the Hat tools.
Cover
It will use hs-colour to try and show which functions are being used for a set of inputs. If the new tracing library is used, and it supports taking the union of traces, this will be used to show coverage from lots of traces. This can be tied into quickcheck.
Excellent, that's a really useful tool for me. You might find some useful code in hat-delta and in hat-cover. Hat-cover contains code that will give you full coverage for a call, while hat-delta contains code that will generate the coverage in the top level function call.
Hat-cover is pretty limited. Just in the last few weeks I have implemented a new and more powerful coverage tool called hpc in collaboration with Andy Gill at Galois. Hpc is not actually a Hat tool; its coverage records and index files are much simpler than Hat traces. But the approach is similar as we have a source transformation, run-time recording via a library, and separate viewing tools. Hpc seems to work quite nicely with QuickCheck, and a simple script can be used to keep testing until coverage reaches a fixpoint. Operations to combine coverage records (eg. union, intersection, difference) are still on our to-do list, but should be straightforward. I attach a README and a tar-ball of our current development version. Comments welcome. We have a paper in preparation and I'd be happy to send you a copy when the first draft is finished. I suppose there could be scope for an hpc GUI too! :-) Colin R HPC PRE-RELEASE PROTOTYPE ========================= We are distributing the prototype of a Haskell tool called hpc to a few potential users, such as yourself. We hope you will try it, and give us your reactions. *** Please do NOT distribute this prototype any further. *** Quite soon we expect to release a version of hpc for general use. It will be open-source. WHAT IS HPC? ------------ Hpc is a tool-kit to record and display Haskell Program Coverage. Hpc includes tools that instrument Haskell programs to record program coverage, run instrumented programs, and display the coverage information obtained. Hpc works by applying a source-to-source transformation; this transformation also generates as a by-product a program-index file (.pix) and module-index files (.mix). The transformed program is compiled with a library; in addition to its usual run-time behaviour the program generates a coverage record in a program-ticks file (.tix). If the program is run more than once, coverage data is accumulated to reflect all runs. Hpc provides coverage information of two kinds: source coverage and boolean-control coverage. Source coverage is the extent to which every part of the program was used, measured at three different levels: declarations (both top-level and local), alternatives (among several equations or case branches) and expressions (at every level). Boolean coverage is the extent to which each of the values True and False is obtained in every syntactic boolean context (ie. guard, condition, qualifier). Hpc displays both kinds of information in two different ways: textual reports with summary statistics (hpc-report) and sources with colour mark-up (hpc-source). For boolean coverage, there are four possible outcomes for each guard, condition or qualifier: both True and False values occur; only True; only False; never evaluated. In hpc-source output, highlighting with a yellow background indicates a part of the program that was never evaluated; a green background indicates an always-True expression and a red background indicates an always-False one. INSTALLING HPC -------------- Requires ghc (6.4*); hmake (3.10); linux or MacOSX; bash. There is not yet a slick installation kit. Pick a suitable directory in which to build hpc and try this: 1. tar xf hpcproto.tar 2. add HPCROOT=$(pwd)/hpc to your environment 3. cd hpc 4. make 5. add $(pwd)/bin to your PATH USING HPC --------- There is no fancy packaging of the hpc tools, just a few shell scripts. Try this: 1. cd to the source directory for a Haskell program -- let's assume the main module is in Main.hs 2. hpc-build Main [build options such as -i..., -I... or -package ...] -- transforms for coverage and builds new executable -- in a subdirectory .hpc, along with index files -- and copies of original sources 3. hpc-run Main [args for Main] -- runs the transformed Main, recording coverage info 4. hpc-report Main [module-name...] -- writes a textual summary of coverage to stdout -- if no modules specified, reports on all 5. hpc-source Main [module-name...] -- generates highlighted <module-name>.hs.html for each module -- if no modules specified, generates all See the ${HPCROOT}/test directory for examples, including a nice way to use hpc with QuickCheck (hpc-fix). LIMITATIONS ----------- * The source transformation is not informed by operator priorities. Operands are treated as the immediate subexpressions of any chain of infix applications. * Most ghc extensions are not yet supported. * Various minor glitches -- you will encounter them soon enough! * Developed using ghc under linux. However, as hpc uses very few extensions beyond Haskell 98 it should port readily to other compilers and environments. EXTENSIONS ---------- There are various ideas for hpc that we have discussed, put aside for now, but might come back to. They include: * extending boolean coverage to boolean arguments of Prelude functions; * extending boolean coverage to functions and argument positions specified by the user; * generalising boolean coverage to value-coverage for other datatypes; * success and failure coverage of argument patterns; * path coverage in the functional dependency graph; * indicating frequency of use, not just coverage; * combining information from more than one coverage record. Andy Gill (andy@galois.com) & Colin Runciman (colin@cs.york.ac.uk) 19 July 2006 (revised 28 July 2006)
participants (5)
-
Colin Runciman
-
Neil Mitchell
-
Olaf Chitil
-
Peter Nuttall
-
Thomas Davie