Open ngua opened 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 .
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
Since we have an autoformatter now, can we just use it as an oracle instead of writing a guide?
I think there's more to style guide than formatting. We should probably have one that is based on Haskell one where possible.
Some PS-specific questions to address:
@klntsky Should not it be closed, as the matter is settled?
@uhbif19 the list in the original post is about things not eforced by the formatter
How about:
f1 $ f2 $ f3 v
over f1 <<< f2 <<< f3 $ v
and (f1 <<< f2 <<< f3) v
I think the first is preferable for purescript since the compose function is more characters.
@rynoV I agree, also, compose uses more stack.
Suggestion:
not $ f a b
over not f a b
. The second will generate more complex JS code and use more stack.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.
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
$
required beforedo
, unlike in Haskell$
with parentheses where it's possible to use only$
sf1 $ f2 $ f3 v
overf1 <<< f2 <<< f3 $ v
and(f1 <<< f2 <<< f3) v
(compose uses more stack and has longer operator name)import Foo.Bar (baz) as X
, notimport Foo.Bar (baz) as Foo.Bar
(avoids boilerplate and clearly indicates the purpose of the import)Contract.*
modules. The motivation is it would makeimport
s management more complicated for the users (the need to choose between modules).language-server
users will have a better UX (there is no need to choose a module if only one module exports an identifier)test/
insrc/
(the reason is: spago only looks up for modules fromsrc/
in dependencies of a project, so that would make CTL unusable as dependency).