Coder Social home page Coder Social logo

Haddock paragraph whitespace about guides HOT 15 CLOSED

freckle avatar freckle commented on August 19, 2024 3
Haddock paragraph whitespace

from guides.

Comments (15)

jdreaver avatar jdreaver commented on August 19, 2024 2

Ah I thought Title meant Summary. If we are being explicit then Summary seems like the right word/style.

from guides.

tfausak avatar tfausak commented on August 19, 2024 1

Just jumping in to say that option A reminds me of Python's docstring conventions:

Multi-line docstrings consist of a summary line just like a one-line docstring, followed by a blank line, followed by a more elaborate description.

So there's precedent for such a guideline 🙂

from guides.

cdparks avatar cdparks commented on August 19, 2024 1

I used to do B, but @pbrisbin brainwashed me, so I've been doing A. I don't really prefer one or the other, but if A's already got the numbers, cool. Hard 👍 on Summary + Body, just like commit messages

from guides.

eborden avatar eborden commented on August 19, 2024 1

from guides.

pbrisbin avatar pbrisbin commented on August 19, 2024

/cc @cdparks @eborden @5outh @jdreaver @rogers89

from guides.

jdreaver avatar jdreaver commented on August 19, 2024

I'm 👍 with the space rules in option A but, does this mean we must have a title line? What about this:

-- | This is a haddocks comment that I am making up for the purpose of demonstration
-- and it is kinda long. Not too long though, since it is just two sentences.
--
foo :: Int
foo = 1

Obviously a rule of thumb for writing in general is to break up long paragraphs, but certainly this paragraph is not too long. I'm all for option A, but if option A enforces having a title then I think I'm 👎

(Note: option A doesn't talk about the Title, option D does, which is why I got this impression):

Haddocks are better with a distinct Title and Body.

from guides.

pbrisbin avatar pbrisbin commented on August 19, 2024

Your example would not be allowed, IMO. What you describe is an omitted mix-match of (D) and (A).

Some other rules I plan to propose are:

  • Haddocks must have a Summary and optional Body
  • Summaries have some rules that are inspired by good commit messages, in this case it must be a single, short, and un-punctuated statement

Only if there is a Body, do the rules in this Issue apply.

So your example would either be:

-- | Something like this
foo :: Int

if it truly is sufficiently simple. Otherwise, you have to jump to

-- | Something shorter
--
-- With whatever you were planning above being here instead. This is a haddocks
-- comment that I am making up for the purpose of demonstration and it is kinda
-- long. Not too long though, since it is just two sentences.
--
foo :: Int
foo = 1

I know you probably want the freedom to go with "but it's just two sentences", but:

  • Not enforcing this really damages the goal of consistency and scannability
  • Enforcing this will foster more documentation, because once you've made the jump from a Summary to a Summary+Body, you are naturally willing to write more in the Body -- this how it works in commit messages

To recap:

  1. Option (A) does not enforce that there is a Body
  2. Other rules would add restrictions on Summary length and formatting
  3. If what you want to write can't fit in (2), you should have a Body

If (2) is controversial, maybe we can open a separate Issue and elicit a separate discussion?

Edited to say "Summary", not "Title"

from guides.

eborden avatar eborden commented on August 19, 2024

I have no skin in this game. You seem passionate about the first option, so I'm down for it.

from guides.

jdreaver avatar jdreaver commented on August 19, 2024

Yeah it reminds me of Python too. I can get onboard with a title + body. I tend to do title + body anyway for much longer Haddock comments, so stomping out the inconsistency for shorter ones should be fine.

from guides.

pbrisbin avatar pbrisbin commented on August 19, 2024

I guess now's the time to decide then:

  • Title + Body (what I did here, for some reason?)
  • Summary + Body (python, git commits)
  • Subject + Body (email)

Edit: Summary won.

from guides.

tfausak avatar tfausak commented on August 19, 2024

For what it's worth, I like option B. The extra blank line before the type signature looks weird to me. But not weird enough that I would actually fight it. And to continue cribbing from Python, every docstring ends with that triple quote on its own line.

from guides.

pbrisbin avatar pbrisbin commented on August 19, 2024

Done. Edited existing stuff to use "Summary" consistently.

from guides.

5outh avatar 5outh commented on August 19, 2024

I'm 👍 on A!

from guides.

pbrisbin avatar pbrisbin commented on August 19, 2024

Closing this issue. My PR will include (A) as well as the other rules hinted at in this thread.

Don't let it being closed stop the GIFs though.

from guides.

tfausak avatar tfausak commented on August 19, 2024

Even though these rules don't apply to me, I'll learn to like the new way.

from guides.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.