Cabal-syntax-3.16.0.0: A library for working with .cabal files
Safe HaskellSafe-Inferred
LanguageHaskell2010

Distribution.Pretty

Documentation

class Pretty a where Source #

Minimal complete definition

pretty

Methods

pretty :: a -> Doc Source #

prettyVersioned :: CabalSpecVersion -> a -> Doc Source #

Instances

Instances details
Instance details

Defined in Distribution.Compiler

Instance details

Defined in Distribution.License

Instance details

Defined in Distribution.System

Instance details

Defined in Distribution.System

Instance details

Defined in Distribution.System

Pretty Dependency Source #
>>> prettyShow $ Dependency (mkPackageName "pkg") anyVersion mainLibSet
"pkg"
>>> prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.insert (LSubLibName $ mkUnqualComponentName "sublib") mainLibSet
"pkg:{pkg,sublib}"
>>> prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.singleton (LSubLibName $ mkUnqualComponentName "sublib")
"pkg:sublib"
>>> prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.insert (LSubLibName $ mkUnqualComponentName "sublib-b") $ NES.singleton (LSubLibName $ mkUnqualComponentName "sublib-a")
"pkg:{sublib-a,sublib-b}"
Pretty FlagAssignment Source #

Since: 3.4.0.0

Instance details

Defined in Distribution.Types.Mixin

Pretty MungedPackageId Source #
>>> 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"
Pretty MungedPackageName Source #

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"
Pretty UnitId Source #

The textual format for UnitId coincides with the format GHC accepts for -package-id.

Pretty VersionRange Source #
>>> fmap pretty (simpleParsec' CabalSpecV1_6 "== 3.2.*" :: Maybe VersionRange)
Just >=3.2 && <3.3
>>> fmap (prettyVersioned CabalSpecV1_6) (simpleParsec' CabalSpecV1_6 "== 3.2.*" :: Maybe VersionRange)
Just ==3.2.*
>>> fmap pretty (simpleParsec' CabalSpecV1_6 "-any" :: Maybe VersionRange)
Just >=0
>>> fmap (prettyVersioned CabalSpecV1_6) (simpleParsec' CabalSpecV1_6 "-any" :: Maybe VersionRange)
Just >=0
Pretty Doc Source #

Since: 3.4.0.0

Instance details

Defined in Distribution.Pretty

Instance details

Defined in Distribution.Pretty

Instance details

Defined in Distribution.Pretty

Instance details

Defined in Distribution.Pretty

(Newtype a b, Sep sep, Pretty b) => Pretty (List sep b a) Source #
Instance details

Defined in Distribution.FieldGrammar.Newtypes

Methods

pretty :: List sep b a -> Doc Source #

prettyVersioned :: CabalSpecVersion -> List sep b a -> Doc Source #

(Newtype a b, Sep sep, Pretty b) => Pretty (NonEmpty' sep b a) Source #
Instance details

Defined in Distribution.FieldGrammar.Newtypes

(Newtype a b, Sep sep, Pretty b) => Pretty (Set' sep b a) Source #
Instance details

Defined in Distribution.FieldGrammar.Newtypes

Methods

pretty :: Set' sep b a -> Doc Source #

prettyVersioned :: CabalSpecVersion -> Set' sep b a -> Doc Source #

Pretty (SymbolicPathX allowAbsolute from to) Source #
Instance details

Defined in Distribution.Utils.Path

Methods

pretty :: SymbolicPathX allowAbsolute from to -> Doc Source #

prettyVersioned :: CabalSpecVersion -> SymbolicPathX allowAbsolute from to -> Doc Source #

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

defaultStyle :: Style Source #

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

flatStyle :: Style Source #

A style for rendering all on one line.

Utilities

showFilePath :: FilePath -> Doc Source #

showToken :: String -> Doc Source #

showTokenStr :: String -> String Source #

showFreeText :: String -> Doc Source #

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 Source #

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

Since: 3.0.0.0

commaSpaceSep :: Pretty a => [a] -> Doc Source #

Separate a list of documents by commas and spaces.

commaSep :: Pretty a => [a] -> Doc Source #

Separate a list of documents by commas.

Deprecated

type Separator = [Doc] -> Doc Source #

AltStyle によって変換されたページ (->オリジナル) /