-
Notifications
You must be signed in to change notification settings - Fork 5
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
Ch-01 What do we mean when we say cabal? #26
base: main
Are you sure you want to change the base?
Conversation
Some starter information about the different meanings for the cabal.
@JonathanLorimer Sorry for being so late on this! I got caught up with some other work. I've started working on it and took some inspiration from your article. Is the structure that I'm following right now okay or should I make some changes? |
@srirajshukla Hey, thanks for taking this up, and no worries life happens. The structure looks fine for now, I will probably have more to say as you write the sections out. |
Hi @JonathanLorimer, when I am trying to make a commit, I'm getting the error that custom prettier failed even though I've formatted the file with prettier and manually checked with it as well.
|
Perhaps do |
I got it working, the pre-commit hook was suggesting a change. I wasn't staging it. 😅 |
@srirajshukla Glad you got it figured out. Sorry for the friction, it can sometimes be a contentious issue whether pre-commit hooks should automatically stage changes or not. Also sorry for the radio silence, I was on vacation. I will have a look at this PR today! |
@JonathanLorimer Hope you had a great vacation! Yeah, about the pre-commit hook thing, can we add it somewhere (maybe in contributing.md or someplace like that). I think I am missing a few references and links, so I'll add them too. And maybe a bit more in the cabal library section. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great start. Thanks again for your contribution. I know I left a lot of comments but I think this is a really great first attempt. Please ping me if you have any questions!
1. [cabal-install](#cabalInstall) is the command line utility to help configure, | ||
compile and install Haskell libraries and programs. | ||
|
||
2. [The Cabal build system](#cabailBuildSystem), a specification for defining |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo here.
2. [The Cabal build system](#cabailBuildSystem), a specification for defining | |
2. [The Cabal build system](#cabalBuildSystem), a specification for defining |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the cabal build system a specification? I think you should also be clear that you are talking about what it commonly referred to as Cabal
(upper case c) here. I think you are 100% right that it is a library that is used by other haskell packages. It might be worth mentioning that Cabal
can take a haskell dependency graph (of external and internal modules) and use GHC to build it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change Cabal build to CABAL build. I can mention "Cabal can take a haskell dependency graph (of external and internal modules) and use GHC to build it." in the details section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JonathanLorimer what would be better? adding it here in tldr section or in the more details section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srirajshukla I am okay with you mentioning the dependency graph bit in the details section. But I still think you need to be careful about using the word specification
. It could be confused with the .cabal
file being a specification for your haskell package. Also I don't think Cabal
is really a specification, it is really just a library and a build system.
2. [The Cabal build system](#cabailBuildSystem), a specification for defining | ||
Haskell packages, together with a library for performing builds. This build | ||
system is used by cabal-install and other package managers (stack for eg). | ||
For eg: parsing .cabal files (among others). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you expand on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking I'd just add one or two-line summaries here. I'll add some more details here then!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srirajshukla I am fine with this tl;dr section being small. But I think if you introduce a concept (like parsing a .cabal file) you need to fully flesh it out, otherwise just don't mention it.
projects whose sets of dependencies might conflict with each other within the | ||
confines of a single system. When cabal-install is asked to build a project, by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you could mention something about version ranges here? https://cabal.readthedocs.io/en/latest/developing-packages.html#modules-imported-from-other-packages
You don't need to go into very much detail, but it might be helpful for the user to understand that they specify a range of acceptable versions and cabal sets out to solve a working package set within those ranges.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a bit about it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JonathanLorimer I've added this much:
"Packages provide a constraint on the version of
various libraries (version range) that will work with their package."
Is this enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that is fine, maybe add something like "Packages provide a constraint on the version of
various libraries (using cabal's version bounds syntax) that will work with their package."
1. Rewrote about `.cabal` section 2. Changed tl;dr for cabal library and added a bit more about it. 3. Changed inline href from anchor tags to direct linking. 4. Fixed typos.
@srirajshukla Thanks for getting these changes in so quickly! I will give this a review tonight. |
out a set of packages and package versions that satisfy it. This set of packages | ||
is drawn from all package and all versions from Hackage as a whole. The chosen | ||
versions of the dependenices will be installed and indexed in a database in the | ||
cabal directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean ~/.cabal
directory? I am pretty sure that's the correct one. It would be good to confirm this in the cabal docs either way.
@JonathanLorimer I was sick for a few days so I didn't do it earlier. I've made the changes. |
Hi @JonathanLorimer , please review it when you've got some time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you include a couple of the suggestions I left, I am happy to approve this. Thanks for the contribution!
1. Fixed some typos pointed out in code review. 2. Added more information on Haskell implementations.
@JonathanLorimer I hope it is fine now. 😅 |
@Mikolaj can you give this a review? |
Not right now, but yes, with pleasure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 👍
The package properties describe the package as a whole, such as name, license, | ||
author, dependenices, etc. It also contains optional information about optional | ||
components such as | ||
[library properties](../new_to_cabal/06_first_cabal_library.md), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick:
"about optional components such as library properties" - sounds weird. Is "library property" an optional component?
I'd change this to [libraries]
. Also in the "optional information about optional components" I'd drop the first "optional".
Since the component is optional, it means it can be left out, so no need to mention the optionality twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, agree. I'll remove the first optional.
1. Fixed some typos pointed out in code review. 2. Added more information on Haskell implementations.
I apologise for the delay in reviewing --- we've just had regressions discovered in the published 3.6 and also CI got completely broken by changes in GitHub Actions. We are still saving the world, but I will review later, unless somebody else does and unblocks you. |
OK, I'm back, will review RSN. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the choice of material, technical accuracy and style. Good job!
@@ -1 +1,96 @@ | |||
# What do we mean when we say cabal? | |||
|
|||
Cabal is an umbrella term that can refer to either "cabal the spec" (.cabal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the package spec"? I wasn't sure if you mean "specification of the cabal software system" or "cabal format spec" or "cabal protocol spec".
## tl;dr | ||
|
||
1. [.cabal file](#the-cabal-file) This is the file that specifies the content of | ||
Haskell packages. The types of information that can be provided via the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd cross out "that can be". There is not so much optionality here, no defaults, a lot of the info is mandatory.
cabal-install and other package managers, stack for example. | ||
|
||
3. [cabal-install](#the-binary-cabal-install-cli-tool) is the command line | ||
utility to help configure, compile and install Haskell libraries and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd change "to help configure" to "for configuring", or something similar, because cabal-install is not a helper that makes it easier. There are no ways to do that except via cabal-inistall.
## The .cabal file | ||
|
||
The .cabal file contains information that drives the compilation and building of | ||
Haskell packages. The .cabal file lives at the root directory that contains the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a native speaker, but I suspect "in root directory".
|
||
The .cabal file contains information that drives the compilation and building of | ||
Haskell packages. The .cabal file lives at the root directory that contains the | ||
haskell source code corresponding to the package. By convention this file is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rephrase to "in root directory of the source tree of the package". Root directory does not contain code. It contains other directories that contain code and other directories, etc.
cabal-install is a frontend to Cabal. It makes it possible to build Haskell | ||
projects whose sets of dependencies might conflict with each other within the | ||
confines of a single system. A package's .cabal file provides a constraint on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is important point, but hard to get across. Perhaps " It's perfectly comfortable building two Haskell projects whose sets of dependencies are conflicting and storing their artefacts to be concurrently employed by the user."
the version of various libraries (version bounds) that they expect. When | ||
cabal-install is asked to build a project, by default it looks at the | ||
dependencies specified in its .cabal file and uses a dependency solver to figure | ||
out a set of packages and package versions that satisfy it. This set of packages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say "packages with their versions" to be able to later on omit "and package versions".
cabal-install is asked to build a project, by default it looks at the | ||
dependencies specified in its .cabal file and uses a dependency solver to figure | ||
out a set of packages and package versions that satisfy it. This set of packages | ||
is drawn from Hackage. The chosen versions of the dependenices will be installed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Hackage (the central Haskell package repository) or another repository specified by the user"; BTW, typo: dependenices
|
||
Conflicts between dependencies are avoided by indexing the installed packages | ||
according to their version and other relevant configuration options. This allows | ||
different projects to retrieve the dependency versions they need. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add "dependency versions and build flavours".
according to their version and other relevant configuration options. This allows | ||
different projects to retrieve the dependency versions they need. | ||
|
||
stack is also a command-line tool that depends on the Cabal Library, and hence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's be high-minded and also compliment ourselves saying something like "stack is another mature command-line tool, with somewhat different goals and trade-offs, that depends...".
This chapter contains the different meanings of the term cabal.
Right now, I've just added the basic skeleton. I'll be adding more information about the topic.