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)