Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default backend should generate TemplateHaskell and write that to a file #190

Open
sgraf812 opened this issue Apr 25, 2021 · 3 comments
Open

Comments

@sgraf812
Copy link
Collaborator

Although the current practice of simply concatenating Strings and dumping the result in a .hs file is simple, I think the general plan should be to do all the staging as part of (Typed?) Template Haskell meta programming. A very reasonable step in-between is to generate a TH AST in the backend which is subsequently pretty-printed to generate the .hs file.

@phadej
Copy link
Contributor

phadej commented Apr 25, 2021

I wonder, @RyanGlScott could clarify, how well the "pretty printing TH expressions / declarations roundtrips".

I recall he spend some time fixing issues, and I'm pretty sure that is subtle.

I mean, that is great, but probably template-haskell "maintainers" (which AFAIK is Ryan alone?) should be aware of this "real production" use scenario.

@int-index
Copy link
Collaborator

The problem is that Happy does not parse/rename the source code, so it cannot embed it in the TH AST.

@Ericson2314
Copy link
Collaborator

I want to give the TH AST extension constructors (Void by default) so arbitrary stuff can be interleaved with the TH AST then printed back.

That would mean happy can use TH and yet also work as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants