Patricia Johann wrote:
>
> For our research, it would be helpful to have a "demodulizer" for Haskell
> --- that is, a program that can translate a Haskell program consisting of
> several modules into a single module. Ideally, this tool would also
> perform "tree shaking", removing functions that are not accessible from a
> specified root module. In particular, we would like to avoid including the
> entire prelude in every program.
>
> Stephen Weeks has written this sort of tool --- the defunctorizer --- for
> Standard ML of New Jersey. The defunctorizer has been very useful for
> adapting SML benchmarks for whole-program compilers.
>
> Is anyone aware of a similar tool for Haskell?
I like this idea, perhaps combined with a tool that does the
type checking and type class removal, letting small Haskell like
compilers have a go at larger Haskell programs.
One problem with such a tool is what is Prelude and what is magic/builtin?
The Prelude more defines an interface that should be followed than
an implementation. Take, for example, Arrays. They are deeply wired
into our compilers. The GHC prelude is actually many modules that are
of increasing levels of complexity and Haskell understanding.
Prelude.hi is just the import portal we all see when compiling!
One interesting question is would GHC, using such a tool,
see similar speedups to GRIN?
Andy Gill