Plutonomicon / cardano-transaction-lib

A Purescript library for building smart contract transactions on Cardano
https://plutonomicon.github.io/cardano-transaction-lib/
MIT License
92 stars 50 forks source link

Purescript style guide #56

Open ngua opened 2 years ago

ngua commented 2 years ago

We have a Haskell style guide which we can partially follow, but we should probably have one for Purescript code as well (and maybe even for FFI code)

Let's use this issue as a list of conventions we try to follow

klntsky commented 2 years ago

This one looks good for me, though it is a bit dated (effect types are not used anymore). Also I don't see a valid rationale for Doubly indent nested record or array literals .

ngua commented 2 years ago

Hmmm, I don't understand that one either. I think some of the guidelines won't work with purty as well. It's probably a good starting point though, thanks for sharing it

klntsky commented 2 years ago

Since we have an autoformatter now, can we just use it as an oracle instead of writing a guide?

adamczykm commented 2 years ago

I think there's more to style guide than formatting. We should probably have one that is based on Haskell one where possible.

klntsky commented 2 years ago

Some PS-specific questions to address:

uhbif19 commented 1 year ago

@klntsky Should not it be closed, as the matter is settled?

klntsky commented 1 year ago

@uhbif19 the list in the original post is about things not eforced by the formatter

rynoV commented 1 year ago

How about:

I think the first is preferable for purescript since the compose function is more characters.

klntsky commented 1 year ago

@rynoV I agree, also, compose uses more stack.

rynoV commented 1 year ago

Suggestion:

I haven't checked this, but based on the definition that would be used for the latter, I think recursively resolving the instances would be less efficient.