Re: A demodulizer for Haskell?
Tue, 20 Jun 2000 17:28:25 -0400 (EDT), Patricia Johann [EMAIL PROTECTED] pisze: 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. I think an opposite tool would be useful :-) -- __(" Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/ \__/GCS/M d- s+:-- a23 C+++$ UL++$ P+++ L++$ E- ^^W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t QRCZAK5? X- R tv-- b+++ DI D- G+ e h! r--%++ y-
RE: RE: A demodulizer for Haskell?
| Are you suggesting that some combination | of GHC flags will allow us to | achieve demodulization? No, it won't. But GHC does actually do a lot of what you want. There is a lot of tricky stuff associated with establishing the correct name space, and GHC does that. You could suck in a Haskell module and print it out fully qualified: module Baz(h,t) where import Wug(h) t = h 7 + 4 would become Baz_t = Prelude.(+) (Wug_h 7) 4 To show that the name-space issue is not trivial, check out: module Foo where import Baz(h) f = h 4 would become Foo_f = Wug_h 4 -- Note Wug_h not Baz_h Other complications in doing this in a standalone tool include dealing with qualified import, hiding, 'as' clauses, and so on. It would be fairly easy to modify GHC to spit out the fully qualified Haskell for one module. You could then just concatenate all the output. Andy's comments about the prelude are on target. You would almost certainly have to treat that specially. Simon |
RE: A demodulizer for Haskell?
Have you looked at GHC? Erik == 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? Patricia Johann Franklyn Turbak
Re: A demodulizer for Haskell?
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