Re: Tool for minimizing examples

2016-10-26 Thread Ben Gamari
Eric Crockett  writes:

> Are there any tools out there that can do any portion of this process for
> me?

This is a good question. Unfortunately I don't know of any; I do my
minimizations by hand.

> Perhaps it is possible to output contents after the compiler does a DCE
> pass?
>
Unfortunately I don't believe this would be helpful as DCE isn't done on
the Haskell syntax tree representation and we have no external
representation of Core.

That being said, you might be able to write something without too much
difficulty using the GHC API. I have a small toy project that I once
used to explore the API; you might find that it's a useful place to
start [1].

Sorry for the not-so-helpful response!

Cheers,

- Ben

[1] https://github.com/bgamari/play-type-search


signature.asc
Description: PGP signature
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


RE: Tool for minimizing examples

2016-10-26 Thread Simon Peyton Jones via ghc-devs
Great question.

And just to add: I _really_ appreciate the fact that you make small examples.  
Thank you.

Simon

From: ghc-devs [mailto:ghc-devs-boun...@haskell.org] On Behalf Of Eric Crockett
Sent: 26 October 2016 05:27
To: ghc-devs <ghc-devs@haskell.org>
Subject: Tool for minimizing examples

Devs: as I'm sure you know, the hardest part of reporting a GHC bug is finding 
a minimal example that triggers the bug. When I initially trigger a bug in my 
large code base, my workflow is something like:

 1. write a driver that triggers the bug
 2. do manual dead code elimination by removing unused files and functions
 3. "human required" step to figure out what can be trimmed to further minimize
 4. go to step 2 until example is simple enouogh

Since I work on a large library (>60 modules) and also report a fair number of 
bugs, I spend a nontrivial amount of time on step 2, which is completely 
mechanical. It would be nice to have a tool that can help out. Specifically, 
something that takes a "driver" file, and produces a copy of the code contents 
to a new directory sans unimported files, and unused functions from imported 
files.

Ideally, this tool would make a "closed universe" assumption so that exported 
functions can also be eliminated as dead, if they are never used elsewhere. A 
bonus feature would be to remove unused imports, and even unused build-depends 
from the cabal file.

Are there any tools out there that can do any portion of this process for me? 
Perhaps it is possible to output contents after the compiler does a DCE pass?

Regards,
Eric Crockett

___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Re: Tool for minimizing examples

2016-10-26 Thread Edward Z. Yang
I asked about this on Twitter a while back
 and John
Regehr suggested that we give C-reduce a try.  I have not
yet but if you try it out I'm quite curious to see what
happens.

Edward

Excerpts from Eric Crockett's message of 2016-10-26 00:27:11 -0400:
> Devs: as I'm sure you know, the hardest part of reporting a GHC bug is
> finding a minimal example that triggers the bug. When I initially trigger a
> bug in my large code base, my workflow is something like:
> 
>  1. write a driver that triggers the bug
>  2. do manual dead code elimination by removing unused files and functions
>  3. "human required" step to figure out what can be trimmed to further
> minimize
>  4. go to step 2 until example is simple enouogh
> 
> Since I work on a large library (>60 modules) and also report a fair number
> of bugs, I spend a nontrivial amount of time on step 2, which is completely
> mechanical. It would be nice to have a tool that can help out.
> Specifically, something that takes a "driver" file, and produces a copy of
> the code contents to a new directory sans unimported files, and unused
> functions from imported files.
> 
> Ideally, this tool would make a "closed universe" assumption so that
> exported functions can also be eliminated as dead, if they are never used
> elsewhere. A bonus feature would be to remove unused imports, and even
> unused build-depends from the cabal file.
> 
> Are there any tools out there that can do any portion of this process for
> me? Perhaps it is possible to output contents after the compiler does a DCE
> pass?
> 
> Regards,
> Eric Crockett
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Tool for minimizing examples

2016-10-25 Thread Eric Crockett
Devs: as I'm sure you know, the hardest part of reporting a GHC bug is
finding a minimal example that triggers the bug. When I initially trigger a
bug in my large code base, my workflow is something like:

 1. write a driver that triggers the bug
 2. do manual dead code elimination by removing unused files and functions
 3. "human required" step to figure out what can be trimmed to further
minimize
 4. go to step 2 until example is simple enouogh

Since I work on a large library (>60 modules) and also report a fair number
of bugs, I spend a nontrivial amount of time on step 2, which is completely
mechanical. It would be nice to have a tool that can help out.
Specifically, something that takes a "driver" file, and produces a copy of
the code contents to a new directory sans unimported files, and unused
functions from imported files.

Ideally, this tool would make a "closed universe" assumption so that
exported functions can also be eliminated as dead, if they are never used
elsewhere. A bonus feature would be to remove unused imports, and even
unused build-depends from the cabal file.

Are there any tools out there that can do any portion of this process for
me? Perhaps it is possible to output contents after the compiler does a DCE
pass?

Regards,
Eric Crockett
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs