-
Notifications
You must be signed in to change notification settings - Fork 27
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
Decide on coding style #24
Comments
Yes, I'd be all for consistent code style. I vote for 2-space indentation. I have no opinion yet about do-notation style (indentation vs. braces). In fact braces style dominates in GHC source code. It seems to be Simon PJ's preferred style and that is most likely explanation why it appears in the library. I initially disliked that style but the truth is that for very long do-block this is really easier to read. And of course I'm all for nuking trailing whitespaces and shortening the lines (where reasonably possible). |
I guess we could just follow the style guide from tibbe (the one I linked above) and just use 2 spaces instead of 4. Would that work for you? (Side note on the do-notation: GHC is not really consistent itself in this regard either and it really depends on which part you look at, e.g., |
Yeah, I agree that style should be just the same (at least for hoopl) because sometimes reading it is pain, and functional programming considered to be beautiful. I also vote for 2 spaces :) |
If 4 spaces don't cause too much trouble with too long lines then I'm fine with that. Alternatively, let's use style that requires less changes. |
@jstolarek I'd really prefer to avoid creating yet another style (that's one of the not-so-nice things about Haskell packages - they often use very different coding styles). Since tibbe's one is both nicely written and used in a few important packages, it seems like a good candidate to just follow (also if you google for "haskell coding style" it's one of the top results). There's a lot of value in consistency even if some details are not exactly what I'd choose myself (just image how cool it'd be to have something like go-fmt for Haskell :-) |
I am not proposing to create a new formatting style. I think tibbe's style is what most people use anyway. And that style guide is silent on the Anyway, no strong opinions from me. Any consistent style is better than an inconsistent one. |
Note that even though the tibbe's style guide is not explicit about the do-notation, all the examples actually use the indentation based one, not the one with braces. So I guess everyone is ok with tibbe's style in general? What about indentation? Should we first try 4 spaces and switch to 2 in case of trouble or do people feel strongly about using 2 spaces? |
Let's try 4 spaces |
I want to minimize the changes to this library. If a change does not improve usability or add new functionality, please don't make the change. |
Why? If we can make the code better why not do so?
Doesn't cleaner code improve things? But if you really don't want to introduce a consistent coding style then let us at least nuke trailing whitespaces. This is mostly annoying, especially that hoopl is used by GHC and GHC itself went through major code cleanups (including trailing whitespace removal) some time ago. |
I have a very conservative approach to maintaining the library. It "cleaner code" is subjective. On 1/18/2016 11:04 PM, Jan Stolarek wrote:
|
Then let us at least clean the trailing whitespaces, like we did with the rest of GHC, shall we? |
@mlite TBH I have to disagree here - I don't think the library works well for the use cases it was designed. After all it's not even fully used in GHC due to performance problems (it seems that GHC doesn't use its transformation capabilities, which is the biggest selling point of the library!) [1, 2]. So I wouldn't rule out large scale changes if we want to fix this. Yes, we probably shouldn't start with rewriting everything, but starting with a very conservative approach from the beginning might be too limiting. If you really do prefer to avoid any major changes to Hoopl, we can also try to just (temporarily?) fork it and see what are the benefits and if it makes sense to merge later. [1] http://mail.haskell.org/pipermail/ghc-devs/2013-October/003120.html |
I don't get why these trialling whitespaces are significant. If yes, On 1/18/2016 11:21 PM, Jan Stolarek wrote:
|
Perhaps, I didn't clarify my position well. I support changes backing BTW, I don't recall the paper mentioned high performance is one design On 1/18/2016 11:35 PM, Michal Terepeta wrote:
|
I think all the problems boil down to stating that trailing whitespaces are semantically irrelevant to humans but that are relevant to computers. Adding or deleting trailing whitespaces shows up as noise in git commits. Many people configure their editors to delete trailing whitespaces on save to prevent introducing accidental changes. Such people would have hard time working with hoopl - they would have to disable trailing whitespace removal or otherwise their commits would contain noise. I personally have Emacs configured in such a way that trailing whitespaces are highlighted in red, which alerts me of the problem but does not fix it automatically. Of course a good next step would be to add a hook that prevents pushing code that adds trailing whitespaces. I believe GHC repository has such a hook. |
@mlite Ok, how about this:
This way we avoid any big "reformatting" for its own sake, but do converge on the coding style over time (as we modify the functionality or performance of the code). Does that sound ok for you guys? |
Yes from me, except that:
this doesn't really happen :-) No one seems to be adding much new code to hoopl. What IMO hoopl needs is a decent code cleanup to get rid of some mess in the code and fix some bad design decisions. I have one of my students working on that at the moment - hopefully something good will come of it :-) |
Reformatting code is never perfect, it could create a big burden to code I like the incremental plan, but please keep in mind avoiding formatting On 1/19/2016 9:59 AM, Michal Terepeta wrote:
|
hoopl is released as an independent hackage, it has users other than GHC. Because hoopl is released with GHC, the hoopl upgrade could have If you plan to push your changes upstream, we want to be notified what On 1/19/2016 10:19 AM, Jan Stolarek wrote:
|
Yes, we're talking about backwards-incompatible changes to the API that will require hoopl clients to adjust their code upon upgrade. But these changes are well-justified. Personally, I would not consider impact of these changes to be "significant". Some code surely will need to be updated but it wont be much.
Sure, I understand that. Actually, I can tell you what the likely changes will be. In 2013 I spent summer at Microsoft Research and hoopl was one of the things I was working on. Back then me and Simon Peyton Jones realized that hoopl has some design flaws. These flaws costed me tens of hours of debugging - I wouldn't have wasted this time had hoopl was better designed. These deficiencies were documented on GHC wiki. The changes that are likely to happen sometime soon are:
|
Minor nitpick as this is not fully accurate: You can easily use a different |
Yes, my code depends on ghc library. On 1/20/2016 2:57 AM, Herbert Valerio Riedel wrote:
|
As decided in haskell#24 let's follow tibbe's style for all new or modified code. Hopefully, with time, we'll end up with code that's a bit more pleasant to read.
As decided in #24 let's follow tibbe's style for all new or modified code. Hopefully, with time, we'll end up with code that's a bit more pleasant to read.
Hi all,
When reading through the library I often find that inconsistent indentation and coding style is making things more difficult to read and understand. A few examples:
So I was wondering if we could simply agree to some already accepted coding style, e.g.,
https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md
What do you think? (I'd be happy to send PRs to convert at least some of the code to the new style, e.g., Dataflow.hs which is non-trivial)
The text was updated successfully, but these errors were encountered: