elm-ast icon indicating copy to clipboard operation
elm-ast copied to clipboard

AST printer?

Open liamcurry opened this issue 8 years ago • 2 comments

Thanks for writing this! I think this will be very useful for an idea I have for converting GraphQL schemas to Elm code. However one key thing that seems to be missing is an AST printer. Is that planned? If not I can try to come up with something.

liamcurry avatar Nov 11 '16 04:11 liamcurry

What do you mean when you say AST printer? A pretty printer? If so, something like that isn't planned and it would be a welcome contribution, but I'd urge you to wait until after Elm 0.18 comes out as I'm likely going to make some significant changes to support positional information in the AST after it does.

Bogdanp avatar Nov 11 '16 08:11 Bogdanp

Basically a function that would take in any Elm AST record and output a string of Elm code. An AST by itself is good for introspection, but a printer is needed to make building/modifying ASTs useful. Some things that would be possible with an Elm AST parser + printer:

  • Rewriting elm-format in Elm (@avh4, thoughts?)
  • Converting a GraphQL introspection query into Elm code

liamcurry avatar Nov 11 '16 14:11 liamcurry