Haskell slicing tool?

senganb@ia.nsc.com senganb@ia.nsc.com
Thu, 21 Mar 2002 22:10:14 -0500


On Wed, 20 Mar 2002 10:42:15 +0000
"Olaf Chitil" <olaf@cs.york.ac.uk> wrote:

> Sengan.Baring-Gould@nsc.com wrote:
> 
> > > > Are there any tools to perform program slicing on Haskell?
> > > > I often find myself wanting to find all "fromJusts" invoked
> > > > from the current function, or all functions that use a
> > > > particular member of my monad's ADT.
> 
> > Actually I was hoping for a static tool.
> 
> I'd be interested to learn for what purpose you want this kind of
> information and also more precisely what you would like such a static
> tool to do for you.
> 
> Olaf

I looked at for what I use the "#" command in vim over the last 2 days,
and when it becomes insufficient:

* Upwards slicing:
- to see what parameters a function is actually given (can be quite a
  long way from where the parameter is actually constructed, versus
  simply passed around).
- to find dead code (function results that are never used)


* Downwards slicing
- to debug code (which head failed? One of those under function f, but
  what are they?)
- which instance of (>>=) is it that I'm using here?

* Complex queries:

  A := set of all functions refered to by f1's definition
  B := set of all functions refered to by f2's definition
  C := set of functions I'm interested in
  D := intersection of A, B and C

D would then be the functions used both by A and B of the set I'm
interested in C.

In general the answer is to understand, debug and refactor code
in larger projects (my current project weighs 4500 lines of Haskell
for instance).

Sengan