This is a small tutorial on the very basics of the Backpack module system. (Well... at least it started that way. It has grown a bit over time.)
It requires cabal-install >= 3.2.0.0 and GHC >= 9.0.1. You can install both using ghcup.
It is a multi-package project. You can build all the packages from this folder using:
cabal build all
Any corrections welcome!
- 00 - convenience libraries
 - 01 - renaming modules
 - 02 - signatures
 - 03 - signature merging
 - 04 - signature thinning
 - 05 - abstract typeclasses
 - 06 - abstracting monad stacks
 - 07 - module identity
 - 08 - transitively indefinite packages
 - 09 - template haskell
 - 10 - coercing proofs
 - 11 - controlling encapsulation
 - 12 - abstracting type families
 
- 
A detailed description in the GHC User Guide of what can be put into a module signature. This is Backpack seen from the language side.
 - 
The Backpack section of the Cabal User Guide and also the sections about module signatures and mixins. This is Backpack seen from the package manager side.
 
- 
Edward Z. Yang's thesis is quite readable and gives a good account of the motivations for Backpack.
 - 
Edward Z. Yang's blog.
 - 
Scott Kilpatrick's thesis. Not as directly applicable to the current implementation of Backpack as Edward Z. Yang's thesis, but useful insights can be gleaned here.
 
- 
relationship between ComponentId, UnitId, MungedPackageId, PackageId etc..
 - 
GHC Issue #20890: Multiple home units and Backpack together.
 
- 
The Backpack and Module Signature entries in the Haskellwiki.
 - 
GHC proposal. Interesting bits about the motivation and limits of Backpack.
 - 
Example of an abstract package on Hackage which uses signatures. Discussed here.
 - 
picnic: put containers into a backpack reddit Features an interesting example of abstracting over classes. (See also lesson 5 of this tutorial.)
 - 
a blog post about common stanzas in .cabal files. Not directly related to Backpack, but both
build-dependsandmixinsfields can be put into common stanzas, which can then be imported by multiple libraries/executables in the package. This can help avoid duplication in the .cabal file. An example. - 
using Backpack to get around problems with overlapping instances
 - 
version 0.3.0 of cryptographic library "raaz" uses Bapckpack internally. ergonomic issues.
 - 
moo-nad A tiny library that combines module signatures and the "
ReaderTpattern". 
- 
Understanding and Evolving the ML Module System by Derek Dreyer.
 - 
Modular Type Classes (2007) reconstruction of Haskell typeclasses in terms of ML modules "classes are signatures, instances are modules"
 - 
ML Modules and Haskell Type Classes: A Constructive Comparison" (2008)
 - 
Logical relations as types by Sterling and Harper. video. This went way over my head, but it seems to propose a method to verify that a module implementation has the same external behaviour as some (presumably simpler) reference implementation.
 - 
Do-it-Yourself Module Systems PhD thesis.
 - 
Repo with a bibliography about ML module systems. web page. Mastodon post.