purescript-codegen / purescript-ps-cst

Purescript code printer, inspired by official purescript-cst types https://hackage.haskell.org/package/purescript/docs/Language-PureScript-CST-Types.html
BSD 3-Clause "New" or "Revised" License
10 stars 5 forks source link

Style guide for generated code #23

Open jvliwanag opened 3 years ago

jvliwanag commented 3 years ago

I'm trying to have a go of #22 and finding out it's not a simple. :)

I'm trying to figure out how to best format the generated code, beyond what I specified on #22. In particular, what style guide we can adhere to.

Options I know of are:

Another option is to state that code formatting is outside of this project's scope and just to pass the output over to a separate tool such as purty.

What do you guys think?

flip111 commented 3 years ago

Maybe just start changing the style bit by bit where needed and allow for configuration to be passed in? That way over time the (total) style can be configured using a configuration file.

paluh commented 3 years ago

I should probably not comment on this as I'm not really familiar with cst and cst-simple.

@jvliwanag do you think that formatting is going bring a lot of complexity to these libs? If that is the case then from my perspective purty is the way to go (this trivial approach works fine in the case of mui bindings).

jvliwanag commented 3 years ago

@paluh comments of course helpful. :)

Passing the generated code over to purty is indeed tempting. But when using a codegen lib, I'd prefer not to have to pull in an additional dependency.

@flip111 I'm going with hat approach thanks. I'll submit a pull req onto this lib that changes the way it formats for now. Then I can work on making it configurable.