We provide three Cabal external commands that operate on any matching input file in the source tree:
dpackmatches on anypackage.dhallwriting<package-name>.cabal.ypackmatches on anypackage.yamlwriting<package-name>.cabal.diy-packmatches on anypackage.dhallwritingpackage.yaml.
The cabal.project is not read or checked. These command find any matching package.dhall or matching package.yaml files in the current or child directories but has options for excluding any of these or including files with other names.
These commands all have similar options:
--package-<ext> GLOBis a glob pattern to include when searching for “package.ext” files.--ignore-glob GLOBis a glob pattern to ignore when searching for files.
These can each be supplied multiple times. If --package-<ext> is not supplied, it defaults to **/package.ext, where “ext” is yaml for the ypack command and dhall for the other 2 commands.
cabal-dpack
The “d” in this dpack command is so named for the “d” of the .dhall extension.
This Cabal external command will generate <package-name>.cabal files for each package.dhall file it finds in the current directory or any child directory.
cabal-ypack
The “y” in this ypack command is so named for the “y” of the .yaml extension.
We’re treating cabal-hpack as a reserved executable name and not named this external command hpack in case Hpack wants to supply its own Cabal external command.
If a project only has package.yaml files and no .cabal files, then Stack will happily generate the corresponding and needed .cabal files before doing its build. Stack has Hpack built in. Cabal doesn’t.
Stack will do the .cabal file generation on any matching package.yaml file in a stack.yaml project. The cabal-ypack executable supplies this missing feature to Cabal as an external command.
The standalone hpack executable operates on one or more input files. This Cabal external command can be used instead of writing a script to find and pass multiple matching package.yaml files to hpack.
cabal-diy-pack
The “d-i-y” of this command is for .dhall into .yaml.
If you already have package.yaml files but are thinking of using package.dhall files instead, then this command can be used to generate the package.yaml files as you undertake the conversion to ensure you effectively have the same input.
If you already have package.yaml files and their matching .cabal files checked in to source control then this command is likely not helpful except in the case where you are debugging why the .cabal files differ when generated from package.dhall files.