Distribution.Pretty

Cabal-3.2.0.0: A framework for packaging Haskell software

Safe Haskell | None
Language | Haskell2010

Distribution.Pretty

Contents

- Utilities
- Deprecated

Synopsis

- class Pretty a where
  - pretty :: a -> Doc
  - prettyVersioned :: CabalSpecVersion -> a -> Doc
- prettyShow :: Pretty a => a -> String
- defaultStyle :: Style
- flatStyle :: Style
- showFilePath :: FilePath -> Doc
- showToken :: String -> Doc
- showFreeText :: String -> Doc
- showFreeTextV3 :: String -> Doc
- type Separator = [Doc] -> Doc

# Documentation

class Pretty a where #

Minimal complete definition

pretty

Methods

pretty :: a -> Doc #

prettyVersioned :: CabalSpecVersion -> a -> Doc #

#### Instances

Instances details

Pretty Bool # |
Instance details Defined in Distribution.Pretty Methods pretty :: Bool -> Doc # prettyVersioned :: CabalSpecVersion -> Bool -> Doc #
Pretty Int # |
Instance details Defined in Distribution.Pretty Methods pretty :: Int -> Doc # prettyVersioned :: CabalSpecVersion -> Int -> Doc #
Pretty Version # |
Instance details Defined in Distribution.Types.Version Methods pretty :: Version -> Doc # prettyVersioned :: CabalSpecVersion -> Version -> Doc #
Pretty VersionRange # |
Instance details Defined in Distribution.Types.VersionRange.Internal Methods pretty :: VersionRange -> Doc # prettyVersioned :: CabalSpecVersion -> VersionRange -> Doc #
Pretty RepoType # |
Instance details Defined in Distribution.Types.SourceRepo Methods pretty :: RepoType -> Doc # prettyVersioned :: CabalSpecVersion -> RepoType -> Doc #
Pretty RepoKind # |
Instance details Defined in Distribution.Types.SourceRepo Methods pretty :: RepoKind -> Doc # prettyVersioned :: CabalSpecVersion -> RepoKind -> Doc #
Pretty PkgconfigVersion # |
Instance details Defined in Distribution.Types.PkgconfigVersion Methods pretty :: PkgconfigVersion -> Doc # prettyVersioned :: CabalSpecVersion -> PkgconfigVersion -> Doc #
Pretty PkgconfigVersionRange # |
Instance details Defined in Distribution.Types.PkgconfigVersionRange Methods pretty :: PkgconfigVersionRange -> Doc # prettyVersioned :: CabalSpecVersion -> PkgconfigVersionRange -> Doc #
Pretty PkgconfigName # |
Instance details Defined in Distribution.Types.PkgconfigName Methods pretty :: PkgconfigName -> Doc # prettyVersioned :: CabalSpecVersion -> PkgconfigName -> Doc #
Pretty PkgconfigDependency # |
Instance details Defined in Distribution.Types.PkgconfigDependency Methods pretty :: PkgconfigDependency -> Doc # prettyVersioned :: CabalSpecVersion -> PkgconfigDependency -> Doc #
Pretty PackageName # |
Instance details Defined in Distribution.Types.PackageName Methods pretty :: PackageName -> Doc # prettyVersioned :: CabalSpecVersion -> PackageName -> Doc #
Pretty UnqualComponentName # |
Instance details Defined in Distribution.Types.UnqualComponentName Methods pretty :: UnqualComponentName -> Doc # prettyVersioned :: CabalSpecVersion -> UnqualComponentName -> Doc #
Pretty PackageVersionConstraint # |
Instance details Defined in Distribution.Types.PackageVersionConstraint Methods pretty :: PackageVersionConstraint -> Doc # prettyVersioned :: CabalSpecVersion -> PackageVersionConstraint -> Doc #
Pretty LibraryVisibility # |
Instance details Defined in Distribution.Types.LibraryVisibility Methods pretty :: LibraryVisibility -> Doc # prettyVersioned :: CabalSpecVersion -> LibraryVisibility -> Doc #
Pretty 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!
    >>> prettyShow $ MungedPackageName "servant" LMainLibName
    "servant"
    >>> prettyShow $ MungedPackageName "servant" (LSubLibName "lackey")
    "z-servant-z-lackey"
Instance details Defined in Distribution.Types.MungedPackageName Methods pretty :: MungedPackageName -> Doc # prettyVersioned :: CabalSpecVersion -> MungedPackageName -> Doc #
Pretty ForeignLibType # |
Instance details Defined in Distribution.Types.ForeignLibType Methods pretty :: ForeignLibType -> Doc # prettyVersioned :: CabalSpecVersion -> ForeignLibType -> Doc #
Pretty ForeignLibOption # |
Instance details Defined in Distribution.Types.ForeignLibOption Methods pretty :: ForeignLibOption -> Doc # prettyVersioned :: CabalSpecVersion -> ForeignLibOption -> Doc #
Pretty FlagName # |
Instance details Defined in Distribution.Types.Flag Methods pretty :: FlagName -> Doc # prettyVersioned :: CabalSpecVersion -> FlagName -> Doc #
Pretty ExecutableScope # |
Instance details Defined in Distribution.Types.ExecutableScope Methods pretty :: ExecutableScope -> Doc # prettyVersioned :: CabalSpecVersion -> ExecutableScope -> Doc #
Pretty ComponentName # |
Instance details Defined in Distribution.Types.ComponentName Methods pretty :: ComponentName -> Doc # prettyVersioned :: CabalSpecVersion -> ComponentName -> Doc #
Pretty ComponentId # |
Instance details Defined in Distribution.Types.ComponentId Methods pretty :: ComponentId -> Doc # prettyVersioned :: CabalSpecVersion -> ComponentId -> Doc #
Pretty BuildType # |
Instance details Defined in Distribution.Types.BuildType Methods pretty :: BuildType -> Doc # prettyVersioned :: CabalSpecVersion -> BuildType -> Doc #
Pretty AbiHash # |
Instance details Defined in Distribution.Types.AbiHash Methods pretty :: AbiHash -> Doc # prettyVersioned :: CabalSpecVersion -> AbiHash -> Doc #
Pretty Platform # |
Instance details Defined in Distribution.System Methods pretty :: Platform -> Doc # prettyVersioned :: CabalSpecVersion -> Platform -> Doc #
Pretty Arch # |
Instance details Defined in Distribution.System Methods pretty :: Arch -> Doc # prettyVersioned :: CabalSpecVersion -> Arch -> Doc #
Pretty OS # |
Instance details Defined in Distribution.System Methods pretty :: OS -> Doc # prettyVersioned :: CabalSpecVersion -> OS -> Doc #
Pretty LicenseRef # |
Instance details Defined in Distribution.SPDX.LicenseReference Methods pretty :: LicenseRef -> Doc # prettyVersioned :: CabalSpecVersion -> LicenseRef -> Doc #
Pretty LicenseId # |
Instance details Defined in Distribution.SPDX.LicenseId Methods pretty :: LicenseId -> Doc # prettyVersioned :: CabalSpecVersion -> LicenseId -> Doc #
Pretty LicenseExceptionId # |
Instance details Defined in Distribution.SPDX.LicenseExceptionId Methods pretty :: LicenseExceptionId -> Doc # prettyVersioned :: CabalSpecVersion -> LicenseExceptionId -> Doc #
Pretty SimpleLicenseExpression # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods pretty :: SimpleLicenseExpression -> Doc # prettyVersioned :: CabalSpecVersion -> SimpleLicenseExpression -> Doc #
Pretty LicenseExpression # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods pretty :: LicenseExpression -> Doc # prettyVersioned :: CabalSpecVersion -> LicenseExpression -> Doc #
Pretty License # |
Instance details Defined in Distribution.SPDX.License Methods pretty :: License -> Doc # prettyVersioned :: CabalSpecVersion -> License -> Doc #
Pretty ModuleName # |
Instance details Defined in Distribution.ModuleName Methods pretty :: ModuleName -> Doc # prettyVersioned :: CabalSpecVersion -> ModuleName -> Doc #
Pretty ModuleRenaming # |
Instance details Defined in Distribution.Types.ModuleRenaming Methods pretty :: ModuleRenaming -> Doc # prettyVersioned :: CabalSpecVersion -> ModuleRenaming -> Doc #
Pretty IncludeRenaming # |
Instance details Defined in Distribution.Types.IncludeRenaming Methods pretty :: IncludeRenaming -> Doc # prettyVersioned :: CabalSpecVersion -> IncludeRenaming -> Doc #
Pretty Mixin # |
Instance details Defined in Distribution.Types.Mixin Methods pretty :: Mixin -> Doc # prettyVersioned :: CabalSpecVersion -> Mixin -> Doc #
Pretty ModuleReexport # |
Instance details Defined in Distribution.Types.ModuleReexport Methods pretty :: ModuleReexport -> Doc # prettyVersioned :: CabalSpecVersion -> ModuleReexport -> Doc #
Pretty TestType # |
Instance details Defined in Distribution.Types.TestType Methods pretty :: TestType -> Doc # prettyVersioned :: CabalSpecVersion -> TestType -> Doc #
Pretty PackageIdentifier # |
Instance details Defined in Distribution.Types.PackageId Methods pretty :: PackageIdentifier -> Doc # prettyVersioned :: CabalSpecVersion -> PackageIdentifier -> Doc #
Pretty DefUnitId # |
Instance details Defined in Distribution.Types.UnitId Methods pretty :: DefUnitId -> Doc # prettyVersioned :: CabalSpecVersion -> DefUnitId -> Doc #
Pretty UnitId # | The textual format for `UnitId` coincides with the format GHC accepts for `-package-id`.
Instance details Defined in Distribution.Types.UnitId Methods pretty :: UnitId -> Doc # prettyVersioned :: CabalSpecVersion -> UnitId -> Doc #
Pretty Module # |
Instance details Defined in Distribution.Types.Module Methods pretty :: Module -> Doc # prettyVersioned :: CabalSpecVersion -> Module -> Doc #
Pretty OpenModule # |
Instance details Defined in Distribution.Backpack Methods pretty :: OpenModule -> Doc # prettyVersioned :: CabalSpecVersion -> OpenModule -> Doc #
Pretty OpenUnitId # |
Instance details Defined in Distribution.Backpack Methods pretty :: OpenUnitId -> Doc # prettyVersioned :: CabalSpecVersion -> OpenUnitId -> Doc #
Pretty ExposedModule # |
Instance details Defined in Distribution.Types.ExposedModule Methods pretty :: ExposedModule -> Doc # prettyVersioned :: CabalSpecVersion -> ExposedModule -> Doc #
Pretty MungedPackageId # |
    >>> prettyShow $ MungedPackageId (MungedPackageName "servant" LMainLibName) (mkVersion [1,2,3])
    "servant-1.2.3"
    >>> prettyShow $ MungedPackageId (MungedPackageName "servant" (LSubLibName "lackey")) (mkVersion [0,1,2])
    "z-servant-z-lackey-0.1.2"
Instance details Defined in Distribution.Types.MungedPackageId Methods pretty :: MungedPackageId -> Doc # prettyVersioned :: CabalSpecVersion -> MungedPackageId -> Doc #
Pretty LegacyExeDependency # |
Instance details Defined in Distribution.Types.LegacyExeDependency Methods pretty :: LegacyExeDependency -> Doc # prettyVersioned :: CabalSpecVersion -> LegacyExeDependency -> Doc #
Pretty ExeDependency # |
Instance details Defined in Distribution.Types.ExeDependency Methods pretty :: ExeDependency -> Doc # prettyVersioned :: CabalSpecVersion -> ExeDependency -> Doc #
Pretty Dependency # |
Instance details Defined in Distribution.Types.Dependency Methods pretty :: Dependency -> Doc # prettyVersioned :: CabalSpecVersion -> Dependency -> Doc #
Pretty BenchmarkType # |
Instance details Defined in Distribution.Types.BenchmarkType Methods pretty :: BenchmarkType -> Doc # prettyVersioned :: CabalSpecVersion -> BenchmarkType -> Doc #
Pretty AbiDependency # |
Instance details Defined in Distribution.Types.AbiDependency Methods pretty :: AbiDependency -> Doc # prettyVersioned :: CabalSpecVersion -> AbiDependency -> Doc #
Pretty License # |
Instance details Defined in Distribution.License Methods pretty :: License -> Doc # prettyVersioned :: CabalSpecVersion -> License -> Doc #
Pretty KnownExtension # |
Instance details Defined in Language.Haskell.Extension Methods pretty :: KnownExtension -> Doc # prettyVersioned :: CabalSpecVersion -> KnownExtension -> Doc #
Pretty Extension # |
Instance details Defined in Language.Haskell.Extension Methods pretty :: Extension -> Doc # prettyVersioned :: CabalSpecVersion -> Extension -> Doc #
Pretty Language # |
Instance details Defined in Language.Haskell.Extension Methods pretty :: Language -> Doc # prettyVersioned :: CabalSpecVersion -> Language -> Doc #
Pretty AbiTag # |
Instance details Defined in Distribution.Compiler Methods pretty :: AbiTag -> Doc # prettyVersioned :: CabalSpecVersion -> AbiTag -> Doc #
Pretty CompilerId # |
Instance details Defined in Distribution.Compiler Methods pretty :: CompilerId -> Doc # prettyVersioned :: CabalSpecVersion -> CompilerId -> Doc #
Pretty CompilerFlavor # |
Instance details Defined in Distribution.Compiler Methods pretty :: CompilerFlavor -> Doc # prettyVersioned :: CabalSpecVersion -> CompilerFlavor -> Doc #
Pretty LibVersionInfo # |
Instance details Defined in Distribution.Types.ForeignLib Methods pretty :: LibVersionInfo -> Doc # prettyVersioned :: CabalSpecVersion -> LibVersionInfo -> Doc #
Pretty FilePathNT # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: FilePathNT -> Doc # prettyVersioned :: CabalSpecVersion -> FilePathNT -> Doc #
Pretty TestedWith # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: TestedWith -> Doc # prettyVersioned :: CabalSpecVersion -> TestedWith -> Doc #
Pretty SpecLicense # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: SpecLicense -> Doc # prettyVersioned :: CabalSpecVersion -> SpecLicense -> Doc #
Pretty SpecVersion # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: SpecVersion -> Doc # prettyVersioned :: CabalSpecVersion -> SpecVersion -> Doc #
Pretty Token' # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: Token' -> Doc # prettyVersioned :: CabalSpecVersion -> Token' -> Doc #
Pretty Token # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: Token -> Doc # prettyVersioned :: CabalSpecVersion -> Token -> Doc #
Pretty TestShowDetails # |
Instance details Defined in Distribution.Simple.Setup Methods pretty :: TestShowDetails -> Doc # prettyVersioned :: CabalSpecVersion -> TestShowDetails -> Doc #
Pretty HaddockTarget # |
Instance details Defined in Distribution.Simple.Setup Methods pretty :: HaddockTarget -> Doc # prettyVersioned :: CabalSpecVersion -> HaddockTarget -> Doc #
Pretty a => Pretty (Identity a) # |
Instance details Defined in Distribution.Pretty Methods pretty :: Identity a -> Doc # prettyVersioned :: CabalSpecVersion -> Identity a -> Doc #
Pretty a => Pretty (MQuoted a) # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: MQuoted a -> Doc # prettyVersioned :: CabalSpecVersion -> MQuoted a -> Doc #
(Newtype a b, Sep sep, Pretty b) => Pretty (Set' sep b a) # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: Set' sep b a -> Doc # prettyVersioned :: CabalSpecVersion -> Set' sep b a -> Doc #
(Newtype a b, Sep sep, Pretty b) => Pretty (List sep b a) # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: List sep b a -> Doc # prettyVersioned :: CabalSpecVersion -> List sep b a -> Doc #

prettyShow :: Pretty a => a -> String #

defaultStyle :: Style #

The default rendering style used in Cabal for console output. It has a fixed page width and adds line breaks automatically.

flatStyle :: Style #

A style for rendering all on one line.

# Utilities

showFilePath :: FilePath -> Doc #

showToken :: String -> Doc #

showFreeText :: String -> Doc #

Pretty-print free-format text, ensuring that it is vertically aligned, and with blank lines replaced by dots for correct re-parsing.

showFreeTextV3 :: String -> Doc #

Pretty-print free-format text. Since `cabal-version: 3.0` we don't replace blank lines with dots.

Since: Cabal-3.0.0.0

# Deprecated

type Separator = [Doc] -> Doc #