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 Quickstart docs to get from zero to hacking faster. #6157

Closed
wants to merge 10 commits into from

Conversation

m-renaud
Copy link
Collaborator

@m-renaud m-renaud commented Jul 25, 2019

I've made a few changes to the structure of the "Quickstart" section of the user guide so that someone new to Cabal can get to a Haskell package they can build and run sooner. Additionally, changes are made given the new Executable default for cabal init when non-interactive is used.

Changes include:

  • Instructions start from an empty directory instead of "assuming we have a project directory and already have a Haskell module or two".
    • Rationale: If someone is reading the quickstart guide its unlikely they already know what a project directory looks like, and are unlikely have any modules already. They instead are probably looking for minimal instructions for how to get started with Haskell+Cabal.
  • TL;DR; section at the top
    • Rationale: Sometimes you don't want to read a bunch of words, you just want a command to copy and paste into your terminal. This provides that.

This partially addresses #6194.

[ci skip]


Please include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • If the change is docs-only, [ci skip] is used to avoid triggering the build bots.

Please also shortly describe how you tested your change. Bonus points for added tests!

@m-renaud m-renaud requested review from 23Skidoo and hvr July 25, 2019 04:28
Copy link
Member

@vrom911 vrom911 left a comment

Choose a reason for hiding this comment

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

Nice work on improving docs!

Cabal/doc/developing-packages.rst Outdated Show resolved Hide resolved
Cabal/doc/developing-packages.rst Outdated Show resolved Hide resolved
Cabal/doc/developing-packages.rst Outdated Show resolved Hide resolved
Cabal/doc/developing-packages.rst Outdated Show resolved Hide resolved
@m-renaud m-renaud requested a review from vrom911 July 26, 2019 21:16
Copy link
Member

@vrom911 vrom911 left a comment

Choose a reason for hiding this comment

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

Very nice improvements to the docs! Thanks, @m-renaud 👍

@phadej
Copy link
Collaborator

phadej commented Jul 28, 2019 via email

@m-renaud
Copy link
Collaborator Author

Hey @phadej, thanks for the feedback!

Note that audience have changed, from ”I cloned a Haskell repository and want to make a change” to ”I want to write a Haskell package”.

I don't think this is true, the audience was never for those cloning a Haskell repo. The previous wording said things like "Lets assume we have created a project directory and already have a Haskell module or two.", if you're at the point where you've found a Haskell repo you want to hack on you almost certainly know about cabal build and cabal run. Also, if they did just clone a repo there would already be a .cabal file and so the whole cabal init section wouldn't be relevant (which is the majority of the changes I've made in this PR). It was already targeted towards "I want to write a Haskell package" but had previous assumptions about the users knowledge which docs should never do (unless explicitly called out).

IMHO former is more common, and latter is not something every user may even need.

I'm going to challenge this assumption, I wouldn't call myself a Haskell newbie by any means, and I've can cabal init to set up a directory for trying something small out orders of magnitude more times than I've cloned well established Haskell repos. It may be the case that for well versed Haskellers cloning an existing project and then hacking on that is the more common use case, and I admit that it is true that the current Haskell community consists of a high proportion of "experts", but the "Quickstart" docs should assume the opposite.

TL;DR don’t forget about the people, ”I cloned a package, what and how I can do next?”

For sure, this is the other common way to "get started" and doesn't really have any docs for it currently afaik. I still think the "Hey, I just learned about Haskell, I want to run through some tutorials, how do I create a file and set up some dependencies that I need?" should be the primary focus if we ever want to grow the Haskell community.

In general I think the overall docs need to be restructured to put these two "I'm just getting started"/quickstart sections much closer to the beginning. I have a bunch of ideas for improving the docs, wasn't sure the best way to solicit feedback before making a bunch of changes though, maybe open an RFC issue?

@tom-audm
Copy link

I respectfully don't understand the purpose of telling newcomers to cabal init --non-interactive in an empty directory:

  • If you're just doing it in an empty directory, you're not solving the case of "I just want a .cabal file so that I can cabal v2-repl," since there are no dependencies you're satisfying - you could simply ghci
  • If the user actually is creating a package, don't they want to specify things like license, author name, is this a library or executable, etc? Sensible defaults are given in interactive mode, too.

It would make most sense to me for the quickstart guide to either be the "what do I do with this cloned repo" that @phadej suggests, or to give the user hand-holding with cabal init.

@m-renaud
Copy link
Collaborator Author

m-renaud commented Mar 21, 2020

Hey @tom-audm and @phadej, reviving this PR due to forced free time :P There are several changes in this PR and I'd like to get as many of them merged in as possible. I'm going to start by attempting to answer the questions you've raised:

If you're just doing it in an empty directory...you could simply ghci

Neither using ghci nor cabal v2-repl create a .cabal file for you to add dependencies, so as soon as you want to use anything beyond what's in base (which is almost immediately because Haskell has a relatively small base library and relies on Hackage packages a lot), you need to figure out how to create a .cabal file anyways, so might as well start with a command that sets the environment up for you.

If the user actually is creating a package, don't they want to specify things like license, author name, is this a library or executable, etc?

If you're a library author who's planning on uploading things to hackage than I think you're beyond the newcomer level and thus are already familiar with the tools. On the other hand, if you're a newcomer to Haskell all you want to know is "How do I get an environment up and running as soon as possible?" In general Haskell's docs throughout the ecosystem aren't the most newcomer friendly. If you look at other languages, for example the Rust - Getting started page, it lays out going from zero to a functioning project with dependencies in a very concise way.

Reading through your comments again it sounds like these are the concerns you have:

  • Previously this content only covered the ”I cloned a package, what and how I can do next?” (non-newcomer workflow), and now it only covers "Run cabal init --non-interactive to get a project set-up from scratch" (newcomer to the language workflow).

    • Proposal: Create two sub-sections: 1) Project from scratch, 2) Existing project, how do I hack on it?
  • Why switch from interactive to non-interactive? We should let users know all of the options and configuration that is available.

    • Re-reading through the changes I made I do call out both interactive and non-interactive and describe what they do. Could you leave comments on the actual code changes and request specific changes so that it's actionable?

I think the major source of misalignment comes from me viewing the "Quickstart" as a "Haskell newcomer quickstart", and (my understanding of) your view as the "Quckstart" to "I want to develop a Haskell package to put on Hackage". The solution to this may be to create a separate "Getting Started" page in the Cabal docs (Proposal: "Section 0. Quickstart" or "Section 0. Getting started with Haskell and Cabal") which mirrors the "Rust - Getting started" page. If this sounds like a reasonable path forward I can put together a PR for comments.

Let me know what you think!

@23Skidoo for thoughts/comments as well.

Copy link
Collaborator

@phadej phadej left a comment

Choose a reason for hiding this comment

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

Looks fine. Some nitpicking inline.

Cabal/doc/developing-packages.rst Outdated Show resolved Hide resolved

Every project needs a name, we'll call this example "proglet".
**TL;DR;** ``mkdir proglet && cd proglet && cabal init --non-interactive && 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.

isn't --non-interactive default now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup, updated, and also explicitly added proglet as the argument to cabal run.

Using "cabal init"
------------------
The ``cabal init`` command creates the necessary files for a Cabal package,
it has both an ``--interactive`` (default) and ``--non-interactive``
Copy link
Collaborator

Choose a reason for hiding this comment

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

haven't these reversed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since I wrote this, yes. Move the (default) to after non-interactive.

...
Linking /path/to/proglet ...

$ 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'd add the executable name. It's nice that cabal run works without it, but that is rare special case.

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.

Linking /path/to/proglet ...

$ cabal run
<Stuff about resolving dependencies, build profile, compliling, linking>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just ...

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.


It is assumed that all the files that make up a package live under a common
project root directory (apart from external dependencies). This simple
example will have all the project files in one directory, but most packages
Copy link
Collaborator

Choose a reason for hiding this comment

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

package files

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.

example will have all the project files in one directory, but most packages
will use one or more subdirectories.

Cabal needs two extra files in the project's root directory:
Copy link
Collaborator

Choose a reason for hiding this comment

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

package's

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.

Cabal/doc/developing-packages.rst Outdated Show resolved Hide resolved
Cabal/doc/developing-packages.rst Outdated Show resolved Hide resolved
Cabal/doc/developing-packages.rst Outdated Show resolved Hide resolved
@phadej
Copy link
Collaborator

phadej commented Mar 21, 2020

I'll change non-interactive init to not pick any license if not explicitly asked by a flag. You should adjust the text accordingly.

The side-effect of above would be that these test projects won't be as such uploadable to Hackage.

If you're a library author who's planning on uploading things to hackage than I think you're beyond the newcomer level and thus are already familiar with the tools.

From my experience, that is not true. People want to upload their stuff to Hackage almost as soon as they get something working, sometimes even a bit before that.

Copy link
Collaborator Author

@m-renaud m-renaud left a comment

Choose a reason for hiding this comment

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

I think my most recent commit addresses your comments, lmk if I missed anything!

Cabal/doc/developing-packages.rst Outdated Show resolved Hide resolved

Every project needs a name, we'll call this example "proglet".
**TL;DR;** ``mkdir proglet && cd proglet && cabal init --non-interactive && cabal run``
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup, updated, and also explicitly added proglet as the argument to cabal run.

Using "cabal init"
------------------
The ``cabal init`` command creates the necessary files for a Cabal package,
it has both an ``--interactive`` (default) and ``--non-interactive``
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since I wrote this, yes. Move the (default) to after non-interactive.

...
Linking /path/to/proglet ...

$ cabal run
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.

Linking /path/to/proglet ...

$ cabal run
<Stuff about resolving dependencies, build profile, compliling, linking>
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.


It is assumed that all the files that make up a package live under a common
project root directory (apart from external dependencies). This simple
example will have all the project files in one directory, but most packages
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.

example will have all the project files in one directory, but most packages
will use one or more subdirectories.

Cabal needs two extra files in the project's root directory:
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.

Cabal/doc/developing-packages.rst Outdated Show resolved Hide resolved
Cabal/doc/developing-packages.rst Outdated Show resolved Hide resolved
Cabal/doc/developing-packages.rst Outdated Show resolved Hide resolved
@m-renaud
Copy link
Collaborator Author

I'll change non-interactive init to not pick any license if not explicitly asked by a flag. You should adjust the text accordingly.

SG. Alternatively I can submit this and you can make the doc change at the same time you change the behaviour (my preference to keep doc updates with code changes).

From my experience, that is not true

Fair enough. I guess I was referring to folks who are just discovering haskell, it's unlikely they'll be uploading to hackage right away, but your point still stands. lmk if you have suggestions for wording tweaks around this.

@m-renaud
Copy link
Collaborator Author

Alright, I think I've addressed all of your comments. Let me know if there's anything else, otherwise can you merge this into master?

@m-renaud m-renaud requested review from phadej and removed request for 23Skidoo and hvr March 22, 2020 01:13
@fgaz
Copy link
Member

fgaz commented Feb 2, 2021

Why did this stall? Is it still up to date?

- Combine interactive and non-interactive sections together, and mention
  which is the default.
- Add output from 'ls' command.
- Add note about Setup.hs being optional
- Small formatting changes.

[ci skip]
@m-renaud m-renaud force-pushed the mrenaud-docs-getting-started branch from febd930 to 99b74ce Compare April 29, 2021 03:35
@m-renaud
Copy link
Collaborator Author

Just rebased but looks like files have changed locations since this was started.

@m-renaud
Copy link
Collaborator Author

Alright, fixed. The rebase blew away the comment anchors though unfortunately.

@m-renaud
Copy link
Collaborator Author

@phadej PTAL when you have a chance.

@Mikolaj
Copy link
Member

Mikolaj commented May 6, 2021

Let me take over the review from @phadej. Unless @emilypi or @fgaz would like to review instead?

@Mikolaj Mikolaj self-requested a review May 6, 2021 21:31
Copy link
Member

@Mikolaj Mikolaj left a comment

Choose a reason for hiding this comment

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

I've reviewed rather shallowly, but apart of a few nitpicks it LGTM and based on the in-depth discussion by the other esteemed reviewers I'd love to see this merged ASAP (sorry for the prolonged process --- the kind souls helping with cabal are smeared rather thin).

doc/developing-packages.rst Outdated Show resolved Hide resolved
doc/developing-packages.rst Outdated Show resolved Hide resolved
doc/developing-packages.rst Outdated Show resolved Hide resolved
doc/developing-packages.rst Outdated Show resolved Hide resolved
doc/developing-packages.rst Outdated Show resolved Hide resolved
@Mikolaj
Copy link
Member

Mikolaj commented May 25, 2021

@m-renaud: do my nitpicks make sense? Let's get this merged.

@m-renaud
Copy link
Collaborator Author

Hey @Mikolaj! Yes, thank you for the review, sorry for the slow reply here; I'll try to get the changes out this week. It could definitely use some active voice rewording (read: more direct) throughout, but I can do that in a follow up.

@Mikolaj Mikolaj removed the request for review from phadej August 10, 2021 22:05
@Mikolaj
Copy link
Member

Mikolaj commented Aug 11, 2021

Hi @m-renaud: I see there crept up conflicts since we last looked at this PR and I'm guilty of adding yet another conflict in #7526 (hurried up in order to backport to 3.6 in time; let's hope we can get this one to 3.6 as well).

Would you like to resolve the conflicts or should I do that?

@m-renaud
Copy link
Collaborator Author

m-renaud commented Aug 16, 2021

Hey @Mikolaj! I'm on vacation until next Monday but can resolve any merge conflicts next week, if that's an acceptable timeframe :)

Edit: next Monday

@Mikolaj
Copy link
Member

Mikolaj commented Aug 16, 2021

@m-renaud: in that case, please don't think about it and enjoy your vacation. :) I will resolve conflicts and if we happen to merge this PR (perhaps even to 3.6) before your return, we can always adjust with your feedback for a point release, after you return.

@Mikolaj
Copy link
Member

Mikolaj commented Aug 16, 2021

The rebased PR is at #7551. Whomever feels like it, please kindly review.

Mikolaj added a commit that referenced this pull request Sep 6, 2021
…tarted

Restructure Getting Started docs to get to a running program faster.

This is rebased (with resolved conflicts) version of #6157 by @m-renaud .
@Mikolaj
Copy link
Member

Mikolaj commented Sep 7, 2021

This was merged as #7551. Thank you, @m-renaud and everybody!

@Mikolaj Mikolaj closed this Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants