HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

ModuleCabal-syntax-3.12.1.0Haskell2010

Distribution.Types.MungedPackageName

  • 1 type
  • 2 values
datadata MungedPackageName
#

A combination of a package and component name used in various legacy interfaces, chiefly bundled with a version as MungedPackageId. It's generally better to use a UnitId to opaquely refer to some compilation/packing unit, but that doesn't always work, e.g. where a "name" is needed, in which case this can be used as a fallback.

Use mkMungedPackageName and unMungedPackageName to convert from/to a String.

In 3.0.0.0 representation was changed from opaque (string) to semantic representation.

Instances12Eq, Data, Ord, Read, Show, Generic, …
  • Eq MungedPackageNameDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.MungedPackageName
  • Data MungedPackageNameDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.MungedPackageName
  • Ord MungedPackageNameDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.MungedPackageName
  • Read MungedPackageNameDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.MungedPackageName
  • Show MungedPackageNameDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.MungedPackageName
  • Generic MungedPackageNameDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.MungedPackageName
  • NFData MungedPackageNameDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.MungedPackageName
  • Binary MungedPackageNameDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.MungedPackageName
  • Parsec MungedPackageNameDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.MungedPackageName
    Example1 expression
    simpleParsec "servant" :: Maybe MungedPackageNameJust (MungedPackageName (PackageName "servant") LMainLibName)
    Example1 expression
    simpleParsec "z-servant-z-lackey" :: Maybe MungedPackageNameJust (MungedPackageName (PackageName "servant") (LSubLibName (UnqualComponentName "lackey")))
    Example1 expression
    simpleParsec "z-servant-zz" :: Maybe MungedPackageNameJust (MungedPackageName (PackageName "z-servant-zz") LMainLibName)
  • Pretty MungedPackageNameDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.MungedPackageName

    Computes the package name for a library. If this is the public library, it will just be the original package name; otherwise, it will be a munged package name recording the original package name as well as the name of the internal library.

    A lot of tooling in the Haskell ecosystem assumes that if something is installed to the package database with the package name foo, then it actually is an entry for the (only public) library in package foo. With internal packages, this is not necessarily true: a public library as well as arbitrarily many internal libraries may come from the same package. To prevent tools from getting confused in this case, the package name of these internal libraries is munged so that they do not conflict the public library proper. A particular case where this matters is ghc-pkg: if we don't munge the package name, the inplace registration will OVERRIDE a different internal library.

    We munge into a reserved namespace, "z-", and encode both the component name and the package name of an internal library using the following format:

    compat-pkg-name ::= "z-" package-name "-z-" library-name

    where package-name and library-name have "-" ( "z" + ) "-" segments encoded by adding an extra "z".

    When we have the public library, the compat-pkg-name is just the package-name, no surprises there!

    Example1 expression
    prettyShow $ MungedPackageName "servant" LMainLibName"servant"
    Example1 expression
    prettyShow $ MungedPackageName "servant" (LSubLibName "lackey")"z-servant-z-lackey"
  • Structured MungedPackageNameDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.MungedPackageName
  • type Rep MungedPackageName = D1 ('MetaData "MungedPackageName" "Distribution.Types.MungedPackageName" "Cabal-syntax-3.12.1.0-3adc" 'False) (C1 ('MetaCons "MungedPackageName" 'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 PackageName) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LibraryName)))Defined in Cabal-syntax-3.12.1.0 · Distribution.Types.MungedPackageName

Intended for internal use only

Example1 expression
encodeCompatPackageName $ MungedPackageName "servant" (LSubLibName "lackey")PackageName "z-servant-z-lackey"

This is used in cabal-install in the Solver. May become obsolete as solver moves to per-component solving.