All you wanted to know about GHCup development.
Main functionality is in
GHCup module. Utility functions are
organised tree-ish in
Anything dealing with ghcup specific directories is in
Download information on where to fetch bindists from is in the ghcup-metadata repository.
This is an open variant, similar to plucky or oops and allows us to combine different error types. Maybe it is too much and it's a little bit unergonomic at times. If it really hurts maintenance, it will be removed. It was more of an experiment.
No use of haskell-TLS
I consider haskell-TLS an interesting experiment, but not a battle-tested and peer-reviewed crypto implementation. There is little to no research about what the intricacies of using haskell for low-level crypto are and how vulnerable such binaries are. Instead, we use either curl the binary or wget. There's also an implementation based on OpenSSL bindings, but it isn't enabled by default, since it would complicate shipping static binaries.
Optics instead of lens
They're a little safer (less Monoid weirdness with view) and have better error messages. Consider the following with lens:
> view (_Just . to (++ "abc")) Nothing ""
> view (_Just % to (++ "abc")) Nothing <interactive>:2:1: error: • An_AffineFold cannot be used as A_Getter • In the expression: view (_Just % to (++ "abc")) Nothing In an equation for ‘it’: it = view (_Just % to (++ "abc")) Nothing
StrictData on by default
Kazu Yamamoto explained it in his PR very well. I like to agree with him. The instances where we need non-strict behavior, we annotate it.
Strict is a little more odd as a default, since it depends on how you define your functions as well.
Code style and formatting
Unfortunately, code formatters are semi-broken on this codebase, due to TH and CPP.
Some light suggestions:
- mtl-style preferred
- no overly pointfree style
wherea lot, so the main function body reads like prose
- documentation is part of the code
Adding a new GHC version
Adding a new CLI command
An example illustration on how to deal with optparse-applicative can be seen here: https://github.com/haskell/ghcup-hs/commit/c19dd5ee8b2edbaf0336af143f1c75b6f4843e26
Every subcommand now lives in its own module under GHCup.OptParse.MyCommand.
- First major refactor included adding cross support. This added
GHCTargetVersion, which includes the target in addition to the version. Most of the
Versionparameters to functions had to be replaced with that and ensured the logic is consistent for cross and non-cross installs.
- This refactor added windows support wrt #130.
The major changes here were switching
hpathlibrary out for
directory(sadly) and introducing a non-unix way of handling processes via the
processlibrary. It also introduced considerable amounts of CPP wrt file handling, installation etc.
- This refactor split up the huge
Main.hsand put every subcommand in its own module: #212
Update version in
ghcupURLmust only be updated if we change the
GHCupInfotype or the YAML representation of it. The version of the YAML represents the change increments.
ghcUpVeris the current application version, read from
Add ChangeLog entry
If a new ghcup yaml version is needed, create one at ghcup-metadata repo and push to a temporary release branch, then update the
data/metadatasubmodule in ghcup-hs repo to that branch, so CI can pass
Commit and git push with tag. Wait for tests to succeed and release artifacts to build.
Download release artifacts and upload them
downloads.haskell.org/~ghcupalong with checksum files (also check
Add ghcup release artifacts to ALL yaml files, see ghcup-metadata repo
Upload the final
ghcup-<ver>.yaml(and a detached GPG sig of it) to
webhost.haskell.org/ghcup/data/(for yaml versions <= 0.0.6) as well as https://github.com/haskell/ghcup-metadata (for all versions).
Update version in
ghvervariable at the top of the script)
Update the top-level ghcup symlinks at
data/metadatasubmodule in ghcup-hs repo to master
Do hackage release
Post on reddit/discourse/etc. and collect rewards