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

Restructure Getting Started documentation to be more compact and beginner friendly #9212

Merged
merged 31 commits into from
Oct 24, 2023

Conversation

malteneuss
Copy link
Collaborator

@malteneuss malteneuss commented Aug 27, 2023

Template Β: This PR does not modify cabal behaviour (documentation, tests, refactoring, etc.)

Include the following checklist in your PR:

edit: I should wait with creating a PR until it is ready for review^^.

doc/getting-started.rst Show resolved Hide resolved
doc/getting-started.rst Show resolved Hide resolved
doc/getting-started.rst Outdated Show resolved Hide resolved
@malteneuss malteneuss changed the title Restructure documentation to be more beginner friendly Restructure Getting Started documentation to be more compact and beginner friendly Aug 27, 2023
@malteneuss malteneuss marked this pull request as ready for review August 27, 2023 09:27


Creating a new application
Creating a Haskell package
Copy link
Collaborator

Choose a reason for hiding this comment

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

The word "application" was deliberately chosen so that the newcomers know that this is the section they should read in order to learn how to create applications with cabal. The word "package", although technically ("more") correct, is intimidating: generally, newcomers don't look for creating packages in a broad sense (and as newcomers they don't know the precise technical sense in the case of cabal packages), because a package in a broad sense is a piece of reusable functionality, which is not what newcomers are after, most of the time.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel strongly about making a distinction between a package and a project. A package is the unit of source code distribution. If you are a deploying applications, you are not distributing source code and you have a different set of problem from those who do.
I am on mobile and I dont remember the content of this section but "application" ~ project.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed. "application" seems to be target outcome of this mini-guide, which also fits the "myapp" package name.


Initializing the application
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Initializing a package
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@@ -185,13 +194,19 @@ The cabal directives are placed in the file within a comment.
main :: IO ()
main = getLine >>= print . chunksOf 3

This can be run using ``cabal run myscript``.
On Unix-like systems this can be run directly with execute permission.
The important sections of a ``.cabal`` file are placed
Copy link
Collaborator

Choose a reason for hiding this comment

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

"important" is judgemental. The previous version was right to not make such a judgement. To be honest, the supported fields are pretty random and changed over the course. Some actually important fields are not supported at all.

Also, "the" looks out of place here because nowhere those have been specified. But maybe native speakers would know better than me.

Copy link
Collaborator

Choose a reason for hiding this comment

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

"The" seems correct there to me; plus I think "necessary" (insofar as they're needed for the script to work) in place of "important".

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you Brandon, I'm happy with your suggestion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Replaced "important" with "necessary"

@ulysses4ever
Copy link
Collaborator

Thanks a lot for taking this on — this is a long-awaited action. But this is a tough one (partly the reason it hasn't been taken on for a while). I left several comments that I feel rather strong about, and that's only after a quick skimming. So, I expect much more word wrestling before it's merged. But rest assured this is a very welcome kind of contribution, and I'm hopeful it will get merged after all the struggle.

@ulysses4ever
Copy link
Collaborator

@malteneuss I'll get back to this soon but currently I'm in a crunch.

@ulysses4ever
Copy link
Collaborator

I just wanna say this is still on my stack, but I'm afraid I'll have time to dig deeper only in the early October. I'm terribly sorry, but I do intend to get back to it unless, that is, someone else from the core team assists in driving this home.

@malteneuss
Copy link
Collaborator Author

No problem. It takes as long as it takes.

Comment on lines 182 to 185
Cabal also supports to run a single self-contained Haskell script like
the following file named ``myscript``:

Choose a reason for hiding this comment

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

I was kind of expecting the haskell-say example to be used here. It would feel more like a natural continuation of what has been written so far.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. I made the examples the same.

doc/getting-started.rst Outdated Show resolved Hide resolved

``app/Main.hs`` is where your package's code lives.
``myapp.cabal`` is Cabal's metadata file which describes your package,
its dependencies and how it is built:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
its dependencies and how it is built:
its dependencies, and how it is built:

oxford commas FTW

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, I think it'd be good to be a little more precise here and say that a package description contains package metadata and a sequence of sections, each defining a package component. Components can be of one of several types (executables, libraries, etc.). Every component describes, among other things, the location of source files and its dependencies.

Could you integrate this description into the text?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done


.. code-block:: console

$ cabal run myfirstapp
$ cabal run
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure I'm a big fan of this change. I'd rather (1) put the component's name back and (2) mention in the text that with one executable in the package, cabal run is smart enough to infer it, so the name can be omitted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

/ / / ^ \ \ |
/ / / / \ \ \ ----|
/ / / / \ \
/____/ /____/ \____\

Project metadata can also be included:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's ditch this detail? I think it's enough for a getting started session and all rest should be read in the respective manual section (handily referenced below).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed

@ulysses4ever
Copy link
Collaborator

At long last, I gave it another go. Let me know what you think...

malteneuss and others added 13 commits October 21, 2023 21:12
Co-authored-by: Artem Pelenitsyn <[email protected]>
Co-authored-by: Artem Pelenitsyn <[email protected]>
Co-authored-by: Artem Pelenitsyn <[email protected]>
Co-authored-by: Artem Pelenitsyn <[email protected]>
Co-authored-by: Artem Pelenitsyn <[email protected]>
Co-authored-by: Artem Pelenitsyn <[email protected]>
Co-authored-by: Artem Pelenitsyn <[email protected]>
Co-authored-by: Artem Pelenitsyn <[email protected]>
Co-authored-by: Artem Pelenitsyn <[email protected]>
Co-authored-by: Artem Pelenitsyn <[email protected]>
Co-authored-by: Artem Pelenitsyn <[email protected]>
Co-authored-by: Artem Pelenitsyn <[email protected]>
@mergify
Copy link
Contributor

mergify bot commented Oct 21, 2023

rebase

✅ Branch has been successfully rebased

@ulysses4ever
Copy link
Collaborator

Remaining fixed one CI failure but introduced another one? @malteneuss can you look into this? https://github.com/haskell/cabal/actions/runs/6599697476/job/17929002660?pr=9212

Reflow sentence to trigger CI
@malteneuss
Copy link
Collaborator Author

malteneuss commented Oct 22, 2023

@ulysses4ever Could you copy the error message? I can't see the reason the job is failing.

edit: It was a typo. Should run through now.

@ulysses4ever
Copy link
Collaborator

Right. As per https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#github-pull-request-conventions you should feel free to apply the merge+squash label whenever you're ready or ask for permissions to apply labels or ask someone (e.g. me) to apply the label.

@malteneuss
Copy link
Collaborator Author

@ulysses4ever I hereby formally request rights to apply labels (e.g. to set "squash+merge me")

@ulysses4ever
Copy link
Collaborator

@malteneuss invited

@malteneuss malteneuss added the squash+merge me Tell Mergify Bot to squash-merge label Oct 22, 2023
@mergify mergify bot added the merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days label Oct 24, 2023
@mergify mergify bot merged commit bc7e8fc into haskell:master Oct 24, 2023
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days squash+merge me Tell Mergify Bot to squash-merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants