API for the Hooks build-type.
Cabal-hooks
This library provides an API for the Cabal Hooks build type.
What is the Hooks build type?
The Hooks build type is a new Cabal build type that is scheduled to replace the Custom build type, providing better integration with the rest of the Haskell ecosystem.
The original specification for the Hooks build type can be found in the associated Haskell Foundation Tech Proposal.
These setup hooks allow package authors to customise the configuration and building of a package by providing certain hooks that get folded into the general package configuration and building logic within Cabal.
Defining a package with custom hooks
To use the Hooks build type, you will need to
Update your
.cabalfile by:- using
cabal-version >= 3.14, - declaring
build-type: Hooks, - declaring a
custom-setupstanza, with asetup-dependsfield which includes a dependency onCabal-hooks.
- using
Define a Haskell module
SetupHooks, which must be placed at the root of your project and must define a valuesetupHooks :: SetupHooks.
That is, your .cabal file should contain the following
-- my-package.cabal
cabal-version: 3.14
name: my-package
build-type: Hooks
custom-setup
setup-depends:
Cabal-hooks >= 3.14 && < 3.15
and your SetupHooks.hs file should look like:
-- SetupHooks.hs
module SetupHooks ( setupHooks ) where
-- Cabal-hooks
import Distribution.Simple.SetupHooks
setupHooks :: SetupHooks
setupHooks = ...
-- use the API provided by 'Distribution.Simple.SetupHooks'
-- to define the hooks relevant to your package
Using the API
The Haddock documentation should help you get started using this library's API.