hpack
A modern format for Haskell packages
https://github.com/sol/hpack#readme
| LTS Haskell 24.16: | 0.38.2 |
| Stackage Nightly 2025-10-24: | 0.38.2 |
| Latest on Hackage: | 0.38.2 |
MIT licensed and maintained by Simon Hengel
This version can be pinned in stack with:
hpack-0.38.2@sha256:26bc63ea8d430e754e7de1c05a39bd7694901015f6d17fd96420dd2b149b8de2,5212Module documentation for 0.38.2
Depends on 24 packages(full list with versions):
Used by 3 packages in nightly-2025-10-24(full list with versions):
See README at https://github.com/sol/hpack#readme
Changes
Changes in 0.38.2
- Infer
cabal-version: 3.12whenPackageInfo_*is used (see #620)
Changes in 0.38.1
- Add support for
extra-files(see #603) - Preserve empty lines in
descriptionwhencabal-version >= 3(see #612)
Changes in 0.38.0
- Generate
build-tool-dependsinstead ofbuild-toolsstarting withcabal-version: 2(fixes #596)
Changes in 0.37.0
- Add support for
asm-optionsandasm-sources(see #573)
Changes in 0.36.1
- Allow
Cabal-3.12.* - Support
base >= 4.20.0(Importsdoes not re-exportData.List.List)
Changes in 0.36.0
- Don’t infer
Paths_-module withspec-version: 0.36.0or later
Changes in 0.35.5
- Add (undocumented)
listcommand
Changes in 0.35.4
- Add
--canonical, which can be used to produce canonical output instead of trying to produce minimal diffs - Avoid unnecessary writes on
--force(see #555) - When an existing
.cabaldoes not align fields then do not align fields in the generated.cabalfile. - Fix a bug related to git conflict markers in existing
.cabalfiles: When a.cabalfile was essentially unchanged, but contained git conflict markers thenhpackdid not write a new.cabalfile at all. To address thishpacknow unconditionally writes a new.cabalfile when the existing.cabalfile contains any git conflict markers.
Changes in 0.35.3
- Depend on
cryptoninstead ofcryptonite
Changes in 0.35.2
- Add support for
ghc-shared-options
Changes in 0.35.1
- Allow
Cabal-3.8.* - Additions to internal API
Changes in 0.35.0
- Add support for
language(thanks @mpilgrem) - Accept Cabal names for fields where Hpack and Cabal use different
terminology, but still warn (e.g. accept
hs-source-dirsas an alias forsource-dirs)
Changes in 0.34.7
- Support
Cabal-3.6.* - Make sure that verbatim
importfields are rendered at the beginning of a section (see #486)
Changes in 0.34.6
- Add
Paths_module toautogen-moduleswhencabal-version >= 2
Changes in 0.34.5
- Compatibility with
aeson-2.*
Changes in 0.34.4
- Render
default-extensions/other-extensionsline-separated - Compatibility with
Cabal-3.4.0.0
Changes in 0.34.3
- Ignore duplicate source directories (see #356)
- Do not infer duplicate modules (see #408, #406, #353)
- Reject empty
then/elsesections (see #362) - Omit conditionals that are always
falsefrom generated.cabalfile (see #404) - Infer correct
cabal-versionwhenPaths_is used withRebindableSyntaxandOverloadedStringsorOverloadedLists(see #400) - Do not use indentation from any existing
.cabalfile if it is invalid (e.g.0) (fixes #252) - Accept lists for
tested-with(see #407) - Render current directory as
./instead of./.for forward compatibility with future version of Cabal
Changes in 0.34.2
- Accept subcomponents as dependencies (close #382)
Changes in 0.34.1
- Fix a bug in
github: ...introduced with0.34.0(f63eb19b956517b4dd8e28dc5785be5889a99298)
Changes in 0.34.0 (deprecated)
- Use
PreferNoHashas defaultGenerateHashStrategy - Add support for library
visibility(see #382) - Reject URLs for
github
Changes in 0.33.1
-
Add
GenerateHashStrategy. The default isPreferHashfor0.33.0and will change toPreferNoHashwith0.34.0. See https://github.com/sol/hpack/pull/390) for details. -
Add command-line options
--hashand--no-hash
Changes in 0.33.0.1
- Silently ignore missing hash when the cabal file content didn’t change at all (for forward compatibility with #390)
Changes in 0.33.0
- Support GHC 8.8.1:
failis no longer a part ofMonad. Instead, it lives in theMonadFailclass. Adapting our code to this change meant changing the types of exporting functions, unfortunately, hence the major version bump.
Changes in 0.32.0
- Support Cabal 3.0
- Switch reexported-modules to comma-separated list
Changes in 0.31.2
- Add default value for maintainer (see #339)
- Escape commas and spaces in filenames when generating cabal files
Changes in 0.31.1
- Show the header when printing to stdout (see #331)
- Add help for
--numeric-version(see #337)
Changes in 0.31.0
- Add
mixinto the fields read by dependencies when they are objects (see #318) hpacknow returns with a successful exit code if the.cabalfile is up to date, even if it was generated by a newer version ofhpack.
Changes in 0.30.0
- Warn on duplicate fields (see #283)
- Always render
cabal-versionasx.yinstead of>= x.yso thatcabal checkdoes not complain (see #322) - Extend
build-toolsso that it subsumes Cabal’sbuild-toolsandbuild-tool-depends(see #254) - Add support for
system-build-tools - Keep declaration order for literal files in c-sources (and other fields that accept glob patterns). This is crucial as a workaround for https://ghc.haskell.org/trac/ghc/ticket/13786 (see #324)
Changes in 0.29.7
- Expose more stuff from
Hpack.Yamlso that it can be used by third parties
Changes in 0.29.6
- Add
spec-version(see #300)
Changes in 0.29.5
- Fix a regression related to indentation sniffing (close #310)
Changes in 0.29.4
- Desugar ^>= when dependency is a string (see #309)
- Add support for Apache, MPL and ISC when inferring
license(see #305)
Changes in 0.29.3
- Desugar
^>=for compatibility withCabal < 2(see #213) - Add support for GPL, LGPL and AGPL when inferring
license(see #305)
Changes in 0.29.2
- Add missing
extra-source-files(see #302)
Changes in 0.29.1
- Infer
licensefromlicense-file
Changes in 0.29.0
- Put the
cabal-versionat the beginning of the generated file. This Is required withcabal-version: 2.1and higher. (see #292) - With
cabal-version: 2.1or higher omit>=when rendering (see #292) - Require
cabal-version: 2.2when SPDX license identifiers are used (see #292) - Map cabal-style licenses to SPDX license identifiers when
cabal-versionis 2.2 or higher (see #292)
Changes in 0.28.2
- Exit with
exitFailureonAlreadyGeneratedByNewerHpackorExistingCabalFileWasModifiedManuallyinHpack.printResult
Changes in 0.28.1
- GHC 8.4.1 compatibility
Changes in 0.28.0
- Add support for
cxx-optionsandcxx-sources(see #205) - Add support for
data-dir(see #100) - Generate valid
.cabalfiles whenverbatimis used top-level (see #280)
Changes in 0.27.0
- Local defaults are now resolved relative to the file they are mentioned in, not the CWD that hpack is invoked from.
Changes in 0.26.0
- Major refactoring of the exposed API (much cleaner now, but lot’s of breaking changes!)
- Remove Git conflict markers before checking the hash of any existing
.cabalfiles (equivalent togit checkout --ours). This allows to regenerate the.cabalfile on conflicts when rebasing without passing-fin some cases and helps with preserving the formatting. - Allow local files to be used as defaults (#248)
Changes in 0.25.0
- Keep non-existing literal files on glob expansion (see #101)
Changes in 0.24.0
- Add support for
verbatimCabal escape hatch - Allow
versionbe a numbers - Ignore fields that start with an underscore everywhere, not just globally
Changes in 0.23.0
- Add support for custom decoders to allow for alternate syntax (e.g. Dhall)
generated-exposed-modulesandgenerated-other-modules, for populating theautogen-modulesfield (#207).- Corrected
cabal-versionsetting forreexported-modulesinside a conditional.
Changes in 0.22.0
- Add support for
defaults - Add
--numeric-version - Add support for
signatures extra-doc-filesrequires settingcabal-versionto at least 1.18; this is now done properly.- Accept bool for
condition(see #230)
Changes in 0.21.2
- Fix a bug in module inference for conditionals (see #236)
- Add support for
extra-doc-files. - Add support for
pkg-config-dependencies
Changes in 0.21.1
- Allow dependency constraints to be numbers (see #234)
Changes in 0.21.0
- Accept section-specific fields in conditionals (see #175, thanks to Scott Fleischman)
- New section:
internal-libraries, for Cabal 2’s internal libraries (see #200).
Changes in 0.20.0
- Do not overwrite any existing cabal file if it has been modified manually
Changes in 0.19.3
- Add support for
frameworksandextra-frameworks-dirs
Changes in 0.19.2
- Compatibility with
Glob >= 0.9.0
Changes in 0.19.1
- Add
IsListinstance forDependencies
Changes in 0.19.0
- Add Paths_* module to executables (see #195, for GHC 8.2.1 compatibility)
- Allow specifying dependencies as a hash (see #198)
Changes in 0.18.1
- Output generated cabal file to
stdoutwhen-is given as a command-line option (see #113) - Recognize
.chs,.y,.lyand.xas Haskell modules when inferring modules for
Changes in 0.18.0
- Make
executablea shortcut ofexecutables: { package-name: ... } - Add support for
ghcjs-optionsandjs-sources(see #161) - Allow
license-fileto be a list - Accept input file on command-line (see #106)
- Add Paths_* when no modules are specified (see #86)
Changes in 0.17.1
- Do not descend into irrelevant directories when inferring modules (see #165)
Changes in 0.17.0
- Added custom-setup section
- Add support for
!includedirectives
Changes in 0.16.0
- Warn when
nameis missing - Support globs in
c-sources - Use binary I/O for cabal files avoiding problems with non-UTF-8 locales
- Fix rendering of
.as directory (cabal syntax issue)