HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

ModuleCabal-3.12.1.0Haskell2010

Distribution.Make

This is an alternative build system that delegates everything to the make program. All the commands just end up calling make with appropriate arguments. The intention was to allow preexisting packages that used makefiles to be wrapped into Cabal packages. In practice essentially all such packages were converted over to the "Simple" build system instead. Consequently this module is not used much and it certainly only sees cursory maintenance and no testing. Perhaps at some point we should stop pretending that it works.

Uses the parsed command-line from Distribution.Simple.Setup in order to build Haskell tools using a back-end build system based on make. Obviously we assume that there is a configure script, and that after the ConfigCmd has been run, there is a Makefile. Further assumptions:

ConfigCmd

We assume the configure script accepts

--with-hc

,

--with-hc-pkg

,

--prefix

,

--bindir

,

--libdir

,

--libexecdir

,

--datadir

.

BuildCmd

We assume that the default Makefile target will build everything.

InstallCmd

We assume there is an

install

target. Note that we assume that this does *not* register the package!

CopyCmd

We assume there is a

copy

target, and a variable

$(destdir)

. The

copy

target should probably just invoke

make install

recursively (e.g.

$(MAKE) install prefix=$(destdir)/$(prefix) bindir=$(destdir)/$(bindir)

. The reason we can't invoke

make install

directly here is that we don't know the value of

$(prefix)

.

SDistCmd

We assume there is a

dist

target.

RegisterCmd

We assume there is a

register

target and a variable

$(user)

.

UnregisterCmd

We assume there is an

unregister

target.

HaddockCmd

We assume there is a

docs

or

doc

target.

  • 12 types
  • 4 classes
  • 29 values
  • PackageCabal-3.12.1.0
  • Exports45
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceMake.hs
classclass Package pkg where
#

Class of things that have a PackageIdentifier

Types in this class are all notions of a package. This allows us to have different types for the different phases that packages go though, from simple name/id, package description, configured or installed packages.

Not all kinds of packages can be uniquely identified by a PackageIdentifier. In particular, installed packages cannot, there may be many installed instances of the same source package.

Methods

Instances9Package, …
  • Package LinkedComponentDefined in Cabal-3.12.1.0 · Distribution.Backpack.LinkedComponent
  • Package PreExistingComponentDefined in Cabal-3.12.1.0 · Distribution.Backpack.PreExistingComponent
  • Package PromisedComponentDefined in Cabal-3.12.1.0 · Distribution.Backpack.PreExistingComponent
  • Package ReadyComponentDefined in Cabal-3.12.1.0 · Distribution.Backpack.ReadyComponent
  • Package GenericPackageDescriptionDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.GenericPackageDescription
  • Package InstalledPackageInfoDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.InstalledPackageInfo
  • Package PackageDescriptionDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.PackageDescription
  • Package PackageIdentifierDefined in Cabal-syntax-3.12.1.0 · Distribution.Package
  • Package (AnnotatedId id)Defined in Cabal-3.12.1.0 · Distribution.Types.AnnotatedId
datadata Module
#

A module identity uniquely identifies a Haskell module by qualifying a ModuleName with the UnitId which defined it. This type distinguishes between two packages which provide a module with the same name, or a module from the same package compiled with different dependencies. There are a few cases where Cabal needs to know about module identities, e.g., when writing out reexported modules in the InstalledPackageInfo.

Instances12Eq, Data, Ord, Read, Show, Generic, …
newtypenewtype AbiHash
#

ABI Hashes

Use mkAbiHash and unAbiHash to convert from/to a String.

This type is opaque since Cabal-2.0

Instances11Eq, Read, Show, IsString, Generic, NFData, …
newtypenewtype ComponentId
#

A ComponentId uniquely identifies the transitive source code closure of a component (i.e. libraries, executables).

For non-Backpack components, this corresponds one to one with the UnitId, which serves as the basis for install paths, linker symbols, etc.

Use mkComponentId and unComponentId to convert from/to a String.

This type is opaque since Cabal-2.0

Instances13Eq, Data, Ord, Read, Show, IsString, …
datadata Dependency
#

Describes a dependency on a source package (API)

Invariant: package name does not appear as LSubLibName in set of library names.

Note: Dependency is not an instance of Ord, and so it cannot be used in Set or as the key to a Map. For these and similar use cases see DependencyMap.

Constructors

Instances12Eq, Data, Ord, Read, Show, Generic, …
  • Eq DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.Dependency
  • Data DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.Dependency
  • Ord DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.Dependency
  • Read DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.Dependency
  • Show DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.Dependency
  • Generic DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.Dependency
  • NFData DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.Dependency
  • Binary DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.Dependency
  • Parsec DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.Dependency
    Example1 expression
    simpleParsec "mylib:sub" :: Maybe DependencyJust (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub") :| [])))
    Example1 expression
    simpleParsec "mylib:{sub1,sub2}" :: Maybe DependencyJust (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub1") :| [LSubLibName (UnqualComponentName "sub2")])))
    Example1 expression
    simpleParsec "mylib:{ sub1 , sub2 }" :: Maybe DependencyJust (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub1") :| [LSubLibName (UnqualComponentName "sub2")])))
    Example1 expression
    simpleParsec "mylib:{ sub1 , sub2 } ^>= 42" :: Maybe DependencyJust (Dependency (PackageName "mylib") (MajorBoundVersion (mkVersion [42])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub1") :| [LSubLibName (UnqualComponentName "sub2")])))
    Example1 expression
    simpleParsec "mylib:{ } ^>= 42" :: Maybe DependencyNothing
    Example1 expression
    traverse_ print (map simpleParsec ["mylib:mylib", "mylib:{mylib}", "mylib:{mylib,sublib}" ] :: [Maybe Dependency])Just (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LMainLibName :| [])))Just (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LMainLibName :| [])))Just (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LMainLibName :| [LSubLibName (UnqualComponentName "sublib")])))

    Spaces around colon are not allowed:

    Example1 expression
    map simpleParsec ["mylib: sub", "mylib :sub", "mylib: {sub1,sub2}", "mylib :{sub1,sub2}"] :: [Maybe Dependency][Nothing,Nothing,Nothing,Nothing]

    Sublibrary syntax is accepted since cabal-version: 3.0

    Example1 expression
    map (`simpleParsec'` "mylib:sub") [CabalSpecV2_4, CabalSpecV3_0] :: [Maybe Dependency][Nothing,Just (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub") :| [])))]
  • Pretty DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.Dependency
    Example1 expression
    prettyShow $ Dependency (mkPackageName "pkg") anyVersion mainLibSet"pkg"
    Example1 expression
    prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.insert (LSubLibName $ mkUnqualComponentName "sublib") mainLibSet"pkg:{pkg, sublib}"
    Example1 expression
    prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.singleton (LSubLibName $ mkUnqualComponentName "sublib")"pkg:sublib"
    Example1 expression
    prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.insert (LSubLibName $ mkUnqualComponentName "sublib-b") $ NES.singleton (LSubLibName $ mkUnqualComponentName "sublib-a")"pkg:{sublib-a, sublib-b}"
  • Structured DependencyDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.Dependency
  • type Rep Dependency = D1 ('MetaData "Dependency" "Distribution.Types.Dependency" "Cabal-syntax-3.12.1.0-3adc" 'False) (C1 ('MetaCons "Dependency" 'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageName) :*: (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VersionRange) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmptySet LibraryName)))))Defined in Cabal-syntax-3.12.1.0 · Distribution.Types.Dependency
datadata PackageIdentifier
#

The name and version of a package.

Constructors

Instances13Eq, Data, Ord, Read, Show, Generic, …
newtypenewtype PackageName
#

A package name.

Use mkPackageName and unPackageName to convert from/to a String.

This type is opaque since Cabal-2.0

Instances13Eq, Data, Ord, Read, Show, IsString, …
newtypenewtype PkgconfigName
#

A pkg-config library name

This is parsed as any valid argument to the pkg-config utility.

Instances13Eq, Data, Ord, Read, Show, IsString, …
newtypenewtype DefUnitId
#

A UnitId for a definite package. The DefUnitId invariant says that a UnitId identified this way is definite; i.e., it has no unfilled holes.

Instances12Eq, Data, Ord, Read, Show, Generic, …
newtypenewtype UnitId
#

A unit identifier identifies a (possibly instantiated) package/component that can be installed the installed package database. There are several types of components that can be installed:

  • A traditional library with no holes, so that unitIdHash is Nothing. In the absence of Backpack, UnitId is the same as a ComponentId.

  • An indefinite, Backpack library with holes. In this case, unitIdHash is still Nothing, but in the install, there are only interfaces, no compiled objects.

  • An instantiated Backpack library with all the holes filled in. unitIdHash is a Just a hash of the instantiating mapping.

A unit is a component plus the additional information on how the holes are filled in. Thus there is a one to many relationship: for a particular component there are many different ways of filling in the holes, and each different combination is a unit (and has a separate UnitId).

UnitId is distinct from OpenUnitId, in that it is always installed, whereas OpenUnitId are intermediate unit identities that arise during mixin linking, and don't necessarily correspond to any actually installed unit. Since the mapping is not actually recorded in a UnitId, you can't actually substitute over them (but you can substitute over OpenUnitId). See also Distribution.Backpack.FullUnitId for a mechanism for expanding an instantiated UnitId to retrieve its mapping.

Backwards compatibility note: if you need to get the string representation of a UnitId to pass, e.g., as a -package-id flag, use the display function, which will work on all versions of Cabal.

Instances13Eq, Data, Ord, Read, Show, IsString, …
valueunUnitId :: UnitId -> String
#

If you need backwards compatibility, consider using display instead, which is supported by all versions of Cabal.

classclass Package pkg => HasUnitId pkg where
#

Packages that have an installed unit ID

Methods

Instances3HasUnitId
  • HasUnitId PreExistingComponentDefined in Cabal-3.12.1.0 · Distribution.Backpack.PreExistingComponent
  • HasUnitId ReadyComponentDefined in Cabal-3.12.1.0 · Distribution.Backpack.ReadyComponent
  • HasUnitId InstalledPackageInfoDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.InstalledPackageInfo
classclass HasUnitId pkg => PackageInstalled pkg where
#

Class of installed packages.

The primary data type which is an instance of this package is InstalledPackageInfo, but when we are doing install plans in Cabal install we may have other, installed package-like things which contain more metadata. Installed packages have exact dependencies installedDepends.

Methods

Instances1PackageInstalled
datadata License
#

Indicates the license under which a package's source code is released. Versions of the licenses not listed here will be rejected by Hackage and cause cabal check to issue a warning.

Constructors

Instances14Eq, Data, Ord, Read, Show, Generic, …
datadata Version
#

A Version represents the version of a software entity.

Instances of Eq and Ord are provided, which gives exact equality and lexicographic ordering of the version number components (i.e. 2.1 > 2.0, 1.2.3 > 1.2.2, etc.).

This type is opaque and distinct from the Version type in Data.Version since Cabal-2.0. The difference extends to the Binary instance using a different (and more compact) encoding.

Instances12Eq, Data, Ord, Read, Show, Generic, …