[Haskell-cafe] GHC Core / STG to supercombinators
csaba.hruska at gmail.com
Mon Apr 9 22:26:20 UTC 2018
I've checked the source code of GHC's simplifier. Regarding the eta
expansion and lambda lifting it seems (according the comments) it does not
guarantee to make these transformations in every case.
If GHC can transform the Core representation to supercombinators, which
transformation sould I use from *CoreToDo*?
Maybe I should give more details:
I'd like to use GHC as a frontend for my custom code generator which can
handle (lazy) top level functions only.
Is it better to use GHC as a library or is it better to write a compiler
plugin to capture the core representation.
I do not want to optimize the Core at all neither want to use other parts
of GHC's backend (i.e. codegen).
Ideally GHC would typecheck and transform everything to top level function
and my system would do the rest.
Do you know what would be the easiest way to do this? (i.e. via *CoreToDo*
or custom calls for the simplifying functions)
On Mon, Apr 9, 2018 at 9:11 PM, Shao Cheng <astrohavoc at gmail.com> wrote:
> Hi Csaba,
> The transformations you described already exist as core simplifier passes.
> For custom compilation, you may write your own pass using the core plugin
> mechanism, see https://downloads.haskell.org/~ghc/latest/docs/html/users_
> It's also possible to perform transformations on STG, but it takes extra
> effort to retrieve/transform the in-memory STG representations, and type
> safety is also not guaranteed.
> Shao Cheng
> On Tue, Apr 10, 2018 at 2:51 AM, Csaba Hruska <csaba.hruska at gmail.com>
>> I wonder what is the easiest way to compile Haskell to supercombinators
>> (top level functions) using GHC as a library.
>> Is it possible to use GHC simplifier to transform the parsed Haskell
>> source to supercombinators? i.e. to do
>> - eta expansion
>> - closure conversion
>> - lambda lifting
>> Or should it be written from scratch?
>> Is Core or STG suited better for this purpose?
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> Only members subscribed via the mailman list are allowed to post.
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe