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_guide/extending_ghc.html#compiler-plugins

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.

Regards,
Shao Cheng

On Tue, Apr 10, 2018 at 2:51 AM, Csaba Hruska <csaba.hruska@gmail.com> wrote:
Hello,

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?

Thanks,
Csaba

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.