Skip to content
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

Merged
merged 1 commit into from Feb 23, 2015
Merged

Conversation

jferris
Copy link
Member

@jferris 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.
Copy link
Contributor

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?

Copy link
Member Author

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.

@jferris
Copy link
Member Author

jferris commented Feb 13, 2015

Ready for re-review.

@pbrisbin
Copy link
Contributor

Awesome. I feel so authoritarian.

LGTM

@jferris
Copy link
Member Author

jferris commented Feb 13, 2015

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.
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Member

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.)

Copy link
Contributor

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?

Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, same here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@jferris
Copy link
Member Author

jferris commented Feb 23, 2015

Any last comments here?

@mike-burns
Copy link
Member

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.
@jferris jferris force-pushed the jf-one-haskell-pragma-per-line branch from 7250bbd to f71de09 Compare February 23, 2015 18:48
@jferris jferris merged commit f71de09 into master Feb 23, 2015
@jferris jferris deleted the jf-one-haskell-pragma-per-line branch February 23, 2015 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants