Comments (15)
Ah I thought Title meant Summary. If we are being explicit then Summary seems like the right word/style.
from guides.
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.
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
from guides.
from guides.
/cc @cdparks @eborden @5outh @jdreaver @rogers89
from guides.
I'm
-- | 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.
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:
- Option (A) does not enforce that there is a Body
- Other rules would add restrictions on Summary length and formatting
- 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.
I have no skin in this game. You seem passionate about the first option, so I'm down for it.
from guides.
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.
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.
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.
Done. Edited existing stuff to use "Summary" consistently.
from guides.
I'm
from guides.
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.
from guides.
Related Issues (14)
- Operator-first / Applicative HOT 15
- Blank line between extension and module HOT 6
- default-extensions rule HOT 26
- Brittany HOT 27
- Handlers Naming Conventions HOT 16
- Compositional pipelines HOT 12
- Add StrictData to default-extensions HOT 22
- Use prettier-markdown? HOT 1
- Link vs Location HOT 10
- Mention MS API Guidelines
- Update response body Guides for API Types HOT 1
- Formalize PATCH Semantics for Sub-Resources HOT 3
- fomatting typo in best-practies HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guides.