Skip to content

RFC: Improve and restructure Cabal user guide #6194

Open
@m-renaud

Description

@m-renaud

Hey all, I wanted to start a discussion about ways the current user guide can be improved. I felt like now may be a good time since the release of cabal-install 3.0 is imminent, and comes with a bunch of usability improvements from the v2-* commands.

Summary of Observed Issues

  • Lack of a to-the-point "Quick Start" at the beginning of the user guide
  • Dual meaning of "Cabal"
  • Lack of focus on "private/project-based workflows"
  • Redundant/outdated information across old-style/new-style docs

Quick Start

Currently, if I'm simply looking for a 1-2 sentence summary of what cabal (read: cabal-install) is and how to get started with it, I can't find one. This is especially troublesome for folks new to Haskell and its build tools who have very little if any pre-requisite knowledge.

To start, a web search for "haskell cabal quick start" gives you:

  1. A link to section 3.1 (Developing Packages) which is definitely not a "quick start" since it already "assume(s) we have created a project directory and already have a Haskell module or two".
  2. A link to this repo
  3. Blog post
  4. Wiki page (unrelated)

None of these are particularly useful. Playing around with search terms you can eventually find the Introduction section which has tonnes of details and gets into the weeds pretty quickly (like that "Cabal packages use the standard compressed tarball format"), with no information for "how to get cabal" or "how to use cabal". You may also find the Nix-style local builds quickstart section which neither sounds "quick start"-ey or is worded as such. It starts with "Suppose that you are in a directory containing a single Cabal package which you wish to build", how am I supposed to get that directory?

In comparison, a search for "haskell stack quick start" prominently features https://docs.haskellstack.org/en/stable/README/ which has all the info you need: a short summary of what it is, how to get it, and how to use it which all fits within a couple screens and doesn't have superfluous information. Similar docs can be found for build tools of other languages as well (Rust, Go, Elm, etc.)

Dual meaning of "Cabal"

I'm sure its been mentioned before, but the fact that "Cabal" can refer to either "a package system for Haskell software" or "a tool for working with packages" can definitely cause confusion, especially those new to the ecosystem. I obviously am not proposing changing the name of either of these, just pointing out that there's ambiguity which makes it very important how content is introduced.

In the docs, the "Cabal the package system" receives more prominence early on than "cabal the build tool" which I think is backwards, since when people first enter the Haskell ecosystem they will begin by encountering "cabal the build tool". They should both be introduced early on of course, just the other way around.

Lack of focus on project-based workflows

All the existing docs assume the use case being addressed by cabal is to develop Haskell packages (read: OSS packages to be uploaded to Hackage). Within this there are two sub-use cases: 1) Starting a new Hackage package from scratch, and 2) Forking an existing Haskell package and hacking on it, the latter being more common.

There is a third use case: what I'll call "project-based workflows", or in other words, new Haskell "projects" which are not meant for public distribution. This group includes many things: simple playground for trying something out, following along with a tutorial, class work for students, private projects, etc. I wager this is the most common use case for cabal-install since only a very small fraction of "packages" that are started become packages on Hackage, and the set of contributors to existing Hackage packages is limited; these two groups are dwarfed by those of beginners, students, and hobbyists.

Reading through the current user guide you learn about installing local packages you've already written, and configuration (like executable-stripping and repository specification) before you learn how to create an empty package, build, and run it. This seems wrong to me.

Redundant/outdated information across old-style/new-style docs

The wording and examples throughout are often referring to old-style use of cabal, whether it be old-style build, sandboxes, locally installing packages for use in a project, etc. Most of the sections in the user guide could use pretty big restructurings (Section 2.2.4 - Developing with sandboxes in particular).

Proposed Changes

Introduce a "Quick Start" section before the current "Introduction"

This would provide a very short and concise overview of "cabal the build tool", how to get it, and how to use it to create a simple Haskell project. It would mention that "cabal" refers to both a "build tool" and a "packaging system", but anyone looking for a "cabal quick start" is almost certainly interested in "cabal the build tool". This would mostly address the first 3 issues I mentioned above, although (3) will require some changes throughout.

Don't focus entirely on the "Hackage package" case

This would probably involve mild wording changes throughout, exact words TBD. Having the "Quick Start" section goes a long way as mentioned above.

Make v2-* commands the default throughout

  • Use v2-build/v2-run in "Quick Start" and in "Introduction" call out old vs. new way
    • Put the FUD about old cabal to bed early on, with concrete example in the "Quick Start" for the modern way of starting a Haskell project with cabal, no cabal hell or sandbox nonesense ;)
  • Move "sandbox" sections to the end (in a legacy section), maybe with a note here and there about how things used to be done
  • Move "Nix-style local builds" content to the section about configuring and building packages

Who's going to make all these changes?

I will! But before I do, I want to get consensus on the general shape of the changes because having these discussions on individual PRs is a pain.

All thoughts and comments welcome!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions