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
Use only one Haskell pragma per line #305
Conversation
jferris
commented
Feb 13, 2015
- With too many on one line, it gets ugly and you'll be forced to wrap.
- You can be consistent if there's only one per line.
@@ -12,6 +12,7 @@ Haskell | |||
* Use comma-first style exports, records, and lists. | |||
* Use four-space indentation except the `where` keyword which is | |||
indented two spaces. [Example]. | |||
* Use only one pragma statement per line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also add that they be alphabetized, or an additional rule for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed that they should. I added another bullet in the "Order" section.
Ready for re-review. |
Awesome. I feel so authoritarian. LGTM |
Cool. I'm going to leave this open for a bit for feedback from others. Note: I probably won't leave this open the usual full week, because there aren't as many people interested in Haskell formatting and I think it's better to move faster at the beginning. |
@@ -5,13 +5,16 @@ Haskell | |||
|
|||
* Break long expressions before operators or keywords. | |||
* Break long type signatures between arguments. | |||
* Don't use a blank line between pragma and module statements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have much of an opinion on it, but why no blank line? I usually add one when I write Haskell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's absolutely no reason whatsoever, just something to decide for
consistency.
To me, having the space just looks weird, like putting a space between a
method and the comment documenting it.
Just based on the code I see around, no space is more common. No idea what
the real numbers could be though.
On Feb 13, 2015 8:36 PM, "Blake Williams" notifications@github.com wrote:
In style/haskell/README.md
#305 (comment):@@ -5,13 +5,16 @@ Haskell
- Break long expressions before operators or keywords.
- Break long type signatures between arguments.
+* Don't use a blank line between pragma and module statements.I don't have much of an opinion on it, but why no blank line? I usually
add one when I write Haskell.—
Reply to this email directly or view it on GitHub
https://github.com/thoughtbot/guides/pull/305/files#r24710363.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find any code on GitHub that formats pragma statements without a subsequent blank line. What code are you looking at?
(On GitHub search results, ghc was the biggest user of language pragmas.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What code are you looking at?
Anything Yesod-related. Maybe it's a Snoyman thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Snoyman!!!! I hadn't gotten to his repos in the GitHub search I did. I just noticed that Snoyman did this to my github library, too. Bah. (Relatedly: GH is really bad at uniquing their search results.)
How about dropping this guide suggestion for now; we can revisit it after we write more code? The pragmas are distinct from the modules, afterall.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about dropping this guide suggestion for now; we can revisit it after we write more code?
Fine with me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about dropping this guide suggestion for now; we can revisit it after we write more code?
I'm not terribly opposed to this, but I'd rather have a guideline and be consistent. Neither way is actually better. I feel like it will just be harder to pick one or the other later, as we'll have more code following different formats.
It looks like ghc-base (probably the largest repository of blessed Haskell code) uses a space after the pragma lines: https://github.com/ghc/packages-base
Any objection to using ghc as a reference for formatting when there's no obvious winner?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with just picking a thing and being consistent, and following ghc makes sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Any last comments here? |
LGTM. |
* With too many on one line, it gets ugly and you'll be forced to wrap. * You can be consistent if there's only one per line. * Use a blank line between pragma and module.
7250bbd
to
f71de09
Compare