
Since most of GHC's optimizations occur on core, not the user-friendly frontend language, doing so would be probably be nontrivial (e.g. we'd want some sort of core to Haskell decompiler.) Edward Excerpts from Ryan Newton's message of Tue Aug 23 13:46:45 -0400 2011:
Edward,
On first glance at your email I misunderstood you as asking about using GHC's optimizer as a source-to-source operation (using GHC as an optimizer, retrieving "partially evaluated" Haskell code). That's not what you were asking for -- but is it possible?
-Ryan
P.S. One compiler that comes to mind that exposes this kind of thing nicely is Chez Scheme ( http://scheme.com/ ). In Chez you can get your hands on "cp0" which does a source to source transform (aka compiler pass zero, after macro expansion), and could use cp0 to preprocess the source and then print it back out.
On Mon, Aug 22, 2011 at 8:48 AM, Edward Z. Yang
wrote: I think this ticket sums it up very nicely!
Cheers, Edward
Excerpts from Max Bolingbroke's message of Mon Aug 22 04:07:59 -0400 2011:
On 21 August 2011 19:20, Edward Z. Yang
wrote: And no sooner do I send this email do I realize we have 'inline' built-in, so I can probably experiment with this right now...
You may be interested in my related ticket #5029: http://hackage.haskell.org/trac/ghc/ticket/5059
I don't think this is totally implausible but you have to be very careful with recursive functions.
Max
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users