cabal-install-3.12.1.0: The command-line interface for Cabal and Hackage.

Safe Haskell | None
Language | Haskell2010

Distribution.Client.Compat.Prelude

Description

This module does two things:

- Acts as a compatibility layer, like `base-compat`.
- Provides commonly used imports.

This module is a superset of Distribution.Compat.Prelude (which this module re-exports)

Synopsis

- module Distribution.Compat.Prelude.Internal
- class Parsec a where
  - parsec :: CabalParsing m => m a
- class Pretty a where
  - pretty :: a -> Doc
  - prettyVersioned :: CabalSpecVersion -> a -> Doc
- data Verbosity
- prettyShow :: Pretty a => a -> String
- class (CharParsing m, MonadPlus m, MonadFail m) => CabalParsing (m :: Type -> Type)
- simpleParsec :: Parsec a => String -> Maybe a
- eitherParsec :: Parsec a => String -> Either String a
- explicitEitherParsec :: ParsecParser a -> String -> Either String a

# Documentation

module Distribution.Compat.Prelude.Internal

class Parsec a where #

Class for parsing with `parsec`. Mainly used for `.cabal` file fields.

For parsing `.cabal` like file structure, see Distribution.Fields.

Methods

parsec :: CabalParsing m => m a #

#### Instances

Instances details

Parsec Glob |
Instance details Defined in Distribution.Simple.Glob.Internal Methods parsec :: CabalParsing m => m Glob #
Parsec HaddockTarget |
Instance details Defined in Distribution.Simple.Setup.Haddock Methods parsec :: CabalParsing m => m HaddockTarget #
Parsec TestShowDetails |
Instance details Defined in Distribution.Simple.Setup.Test Methods parsec :: CabalParsing m => m TestShowDetails #

Parsec Verbosity

Parser verbosity

    >>> explicitEitherParsec parsecVerbosity "normal"
    Right (Verbosity {vLevel = Normal, vFlags = fromList [], vQuiet = False})

    >>> explicitEitherParsec parsecVerbosity "normal+nowrap  "
    Right (Verbosity {vLevel = Normal, vFlags = fromList [VNoWrap], vQuiet = False})

    >>> explicitEitherParsec parsecVerbosity "normal+nowrap +markoutput"
    Right (Verbosity {vLevel = Normal, vFlags = fromList [VNoWrap,VMarkOutput], vQuiet = False})

    >>> explicitEitherParsec parsecVerbosity "normal +nowrap +markoutput"
    Right (Verbosity {vLevel = Normal, vFlags = fromList [VNoWrap,VMarkOutput], vQuiet = False})

    >>> explicitEitherParsec parsecVerbosity "normal+nowrap+markoutput"
    Right (Verbosity {vLevel = Normal, vFlags = fromList [VNoWrap,VMarkOutput], vQuiet = False})

    >>> explicitEitherParsec parsecVerbosity "deafening+nowrap+stdout+stderr+callsite+callstack"
    Right (Verbosity {vLevel = Deafening, vFlags = fromList [VCallStack,VCallSite,VNoWrap,VStderr], vQuiet = False})

Note: this parser will eat trailing spaces.

Instance details Defined in Distribution.Verbosity Methods parsec :: CabalParsing m => m Verbosity #

Parsec OpenModule

    >>> eitherParsec "Includes2-0.1.0.0-inplace-mysql:Database.MySQL" :: Either String OpenModule
    Right (OpenModule (DefiniteUnitId (DefUnitId {unDefUnitId = UnitId "Includes2-0.1.0.0-inplace-mysql"})) (ModuleName "Database.MySQL"))

Instance details Defined in Distribution.Backpack Methods parsec :: CabalParsing m => m OpenModule #

Parsec OpenUnitId

    >>> eitherParsec "foobar" :: Either String OpenUnitId
    Right (DefiniteUnitId (DefUnitId {unDefUnitId = UnitId "foobar"}))

    >>> eitherParsec "foo[Str=text-1.2.3:Data.Text.Text]" :: Either String OpenUnitId
    Right (IndefFullUnitId (ComponentId "foo") (fromList [(ModuleName "Str",OpenModule (DefiniteUnitId (DefUnitId {unDefUnitId = UnitId "text-1.2.3"})) (ModuleName "Data.Text.Text"))]))

Instance details Defined in Distribution.Backpack Methods parsec :: CabalParsing m => m OpenUnitId #
Parsec AbiTag |
Instance details Defined in Distribution.Compiler Methods parsec :: CabalParsing m => m AbiTag #
Parsec CompilerFlavor |
Instance details Defined in Distribution.Compiler Methods parsec :: CabalParsing m => m CompilerFlavor #
Parsec CompilerId |
Instance details Defined in Distribution.Compiler Methods parsec :: CabalParsing m => m CompilerId #
Parsec FilePathNT |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods parsec :: CabalParsing m => m FilePathNT #
Parsec SpecLicense |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods parsec :: CabalParsing m => m SpecLicense #
Parsec SpecVersion |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods parsec :: CabalParsing m => m SpecVersion #
Parsec TestedWith |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods parsec :: CabalParsing m => m TestedWith #
Parsec Token |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods parsec :: CabalParsing m => m Token #
Parsec Token' |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods parsec :: CabalParsing m => m Token' #
Parsec License |
Instance details Defined in Distribution.License Methods parsec :: CabalParsing m => m License #
Parsec ModuleName |
Instance details Defined in Distribution.ModuleName Methods parsec :: CabalParsing m => m ModuleName #
Parsec CompatFilePath |
Instance details Defined in Distribution.PackageDescription.FieldGrammar Methods parsec :: CabalParsing m => m CompatFilePath #
Parsec CompatLicenseFile |
Instance details Defined in Distribution.PackageDescription.FieldGrammar Methods parsec :: CabalParsing m => m CompatLicenseFile #

Parsec License

    >>> eitherParsec "BSD-3-Clause AND MIT" :: Either String License
    Right (License (EAnd (ELicense (ELicenseId BSD_3_Clause) Nothing) (ELicense (ELicenseId MIT) Nothing)))

    >>> eitherParsec "NONE" :: Either String License
    Right NONE

Instance details Defined in Distribution.SPDX.License Methods parsec :: CabalParsing m => m License #
Parsec LicenseExceptionId |
Instance details Defined in Distribution.SPDX.LicenseExceptionId Methods parsec :: CabalParsing m => m LicenseExceptionId #
Parsec LicenseExpression |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods parsec :: CabalParsing m => m LicenseExpression #
Parsec SimpleLicenseExpression |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods parsec :: CabalParsing m => m SimpleLicenseExpression #

Parsec LicenseId

    >>> eitherParsec "BSD-3-Clause" :: Either String LicenseId
    Right BSD_3_Clause

    >>> eitherParsec "BSD3" :: Either String LicenseId
    Left "...Unknown SPDX license identifier: 'BSD3' Do you mean BSD-3-Clause?"

Instance details Defined in Distribution.SPDX.LicenseId Methods parsec :: CabalParsing m => m LicenseId #
Parsec LicenseRef |
Instance details Defined in Distribution.SPDX.LicenseReference Methods parsec :: CabalParsing m => m LicenseRef #
Parsec Arch |
Instance details Defined in Distribution.System Methods parsec :: CabalParsing m => m Arch #
Parsec OS |
Instance details Defined in Distribution.System Methods parsec :: CabalParsing m => m OS #
Parsec Platform |
Instance details Defined in Distribution.System Methods parsec :: CabalParsing m => m Platform #
Parsec AbiDependency |
Instance details Defined in Distribution.Types.AbiDependency Methods parsec :: CabalParsing m => m AbiDependency #
Parsec AbiHash |
Instance details Defined in Distribution.Types.AbiHash Methods parsec :: CabalParsing m => m AbiHash #
Parsec BenchmarkType |
Instance details Defined in Distribution.Types.BenchmarkType Methods parsec :: CabalParsing m => m BenchmarkType #
Parsec BuildType |
Instance details Defined in Distribution.Types.BuildType Methods parsec :: CabalParsing m => m BuildType #
Parsec ComponentId |
Instance details Defined in Distribution.Types.ComponentId Methods parsec :: CabalParsing m => m ComponentId #
Parsec ComponentName |
Instance details Defined in Distribution.Types.ComponentName Methods parsec :: CabalParsing m => m ComponentName #

Parsec Dependency

    >>> simpleParsec "mylib:sub" :: Maybe Dependency
    Just (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub") :| [])))

    >>> simpleParsec "mylib:{sub1,sub2}" :: Maybe Dependency
    Just (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub1") :| [LSubLibName (UnqualComponentName "sub2")])))

    >>> simpleParsec "mylib:{ sub1 , sub2 }" :: Maybe Dependency
    Just (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub1") :| [LSubLibName (UnqualComponentName "sub2")])))

    >>> simpleParsec "mylib:{ sub1 , sub2 } ^>= 42" :: Maybe Dependency
    Just (Dependency (PackageName "mylib") (MajorBoundVersion (mkVersion [42])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub1") :| [LSubLibName (UnqualComponentName "sub2")])))

    >>> simpleParsec "mylib:{ } ^>= 42" :: Maybe Dependency
    Nothing

    >>> 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:

    >>> 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`

    >>> map (`simpleParsec'` "mylib:sub") [CabalSpecV2_4, CabalSpecV3_0] :: [Maybe Dependency]
    [Nothing,Just (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub") :| [])))]

Instance details Defined in Distribution.Types.Dependency Methods parsec :: CabalParsing m => m Dependency #

Parsec ExeDependency

Examples

    >>> simpleParsec "happy:happy" :: Maybe ExeDependency
    Just (ExeDependency (PackageName "happy") (UnqualComponentName "happy") (OrLaterVersion (mkVersion [0])))

    >>> simpleParsec "happy:happy >= 1.19.12" :: Maybe ExeDependency
    Just (ExeDependency (PackageName "happy") (UnqualComponentName "happy") (OrLaterVersion (mkVersion [1,19,12])))

    >>> simpleParsec "happy:happy>=1.19.12" :: Maybe ExeDependency
    Just (ExeDependency (PackageName "happy") (UnqualComponentName "happy") (OrLaterVersion (mkVersion [1,19,12])))

    >>> simpleParsec "happy : happy >= 1.19.12" :: Maybe ExeDependency
    Nothing

    >>> simpleParsec "happy: happy >= 1.19.12" :: Maybe ExeDependency
    Nothing

    >>> simpleParsec "happy :happy >= 1.19.12" :: Maybe ExeDependency
    Nothing

Instance details Defined in Distribution.Types.ExeDependency Methods parsec :: CabalParsing m => m ExeDependency #
Parsec ExecutableScope |
Instance details Defined in Distribution.Types.ExecutableScope Methods parsec :: CabalParsing m => m ExecutableScope #
Parsec ExposedModule |
Instance details Defined in Distribution.Types.ExposedModule Methods parsec :: CabalParsing m => m ExposedModule #

Parsec FlagAssignment

    >>> simpleParsec "" :: Maybe FlagAssignment
    Just (fromList [])

    >>> simpleParsec "+foo -bar" :: Maybe FlagAssignment
    Just (fromList [(FlagName "bar",(1,False)),(FlagName "foo",(1,True))])

    >>> simpleParsec "-none -any" :: Maybe FlagAssignment
    Just (fromList [(FlagName "any",(1,False)),(FlagName "none",(1,False))])

    >>> simpleParsec "+foo -foo +foo +foo" :: Maybe FlagAssignment
    Just (fromList [(FlagName "foo",(4,True))])

    >>> simpleParsec "+foo -bar baz" :: Maybe FlagAssignment
    Nothing

Issue #7279 was fixed in Cabal-3.8

    >>> explicitEitherParsec (parsecCommaList parsec) "+foo , -bar" :: Either String [FlagAssignment]
    Right [fromList [(FlagName "foo",(1,True))],fromList [(FlagName "bar",(1,False))]]

    >>> explicitEitherParsec (parsecCommaList parsecFlagAssignmentNonEmpty) "+foo , -bar" :: Either String [FlagAssignment]
    Right [fromList [(FlagName "foo",(1,True))],fromList [(FlagName "bar",(1,False))]]

    >>> simpleParsec "+foo+foo" :: Maybe FlagAssignment
    Nothing

Since: Cabal-syntax-3.4.0.0

Instance details Defined in Distribution.Types.Flag Methods parsec :: CabalParsing m => m FlagAssignment #
Parsec FlagName |
Instance details Defined in Distribution.Types.Flag Methods parsec :: CabalParsing m => m FlagName #
Parsec LibVersionInfo |
Instance details Defined in Distribution.Types.ForeignLib Methods parsec :: CabalParsing m => m LibVersionInfo #
Parsec ForeignLibOption |
Instance details Defined in Distribution.Types.ForeignLibOption Methods parsec :: CabalParsing m => m ForeignLibOption #
Parsec ForeignLibType |
Instance details Defined in Distribution.Types.ForeignLibType Methods parsec :: CabalParsing m => m ForeignLibType #
Parsec IncludeRenaming |
Instance details Defined in Distribution.Types.IncludeRenaming Methods parsec :: CabalParsing m => m IncludeRenaming #
Parsec CompatPackageKey |
Instance details Defined in Distribution.Types.InstalledPackageInfo.FieldGrammar Methods parsec :: CabalParsing m => m CompatPackageKey #
Parsec ExposedModules |
Instance details Defined in Distribution.Types.InstalledPackageInfo.FieldGrammar Methods parsec :: CabalParsing m => m ExposedModules #
Parsec InstWith |
Instance details Defined in Distribution.Types.InstalledPackageInfo.FieldGrammar Methods parsec :: CabalParsing m => m InstWith #
Parsec SpecLicenseLenient |
Instance details Defined in Distribution.Types.InstalledPackageInfo.FieldGrammar Methods parsec :: CabalParsing m => m SpecLicenseLenient #
Parsec LegacyExeDependency |
Instance details Defined in Distribution.Types.LegacyExeDependency Methods parsec :: CabalParsing m => m LegacyExeDependency #
Parsec LibraryVisibility |
Instance details Defined in Distribution.Types.LibraryVisibility Methods parsec :: CabalParsing m => m LibraryVisibility #

Parsec Mixin

    >>> simpleParsec "mylib" :: Maybe Mixin
    Just (Mixin {mixinPackageName = PackageName "mylib", mixinLibraryName = LMainLibName, mixinIncludeRenaming = IncludeRenaming {includeProvidesRn = DefaultRenaming, includeRequiresRn = DefaultRenaming}})

    >>> simpleParsec "thatlib:sublib" :: Maybe Mixin
    Just (Mixin {mixinPackageName = PackageName "thatlib", mixinLibraryName = LSubLibName (UnqualComponentName "sublib"), mixinIncludeRenaming = IncludeRenaming {includeProvidesRn = DefaultRenaming, includeRequiresRn = DefaultRenaming}})

    >>> simpleParsec "thatlib:thatlib" :: Maybe Mixin
    Just (Mixin {mixinPackageName = PackageName "thatlib", mixinLibraryName = LMainLibName, mixinIncludeRenaming = IncludeRenaming {includeProvidesRn = DefaultRenaming, includeRequiresRn = DefaultRenaming}})

Sublibrary syntax is accepted since `cabal-version: 3.4`.

    >>> map (`simpleParsec'` "mylib:sub") [CabalSpecV3_0, CabalSpecV3_4] :: [Maybe Mixin]
    [Nothing,Just (Mixin {mixinPackageName = PackageName "mylib", mixinLibraryName = LSubLibName (UnqualComponentName "sub"), mixinIncludeRenaming = IncludeRenaming {includeProvidesRn = DefaultRenaming, includeRequiresRn = DefaultRenaming}})]

Instance details Defined in Distribution.Types.Mixin Methods parsec :: CabalParsing m => m Mixin #
Parsec Module |
Instance details Defined in Distribution.Types.Module Methods parsec :: CabalParsing m => m Module #
Parsec ModuleReexport |
Instance details Defined in Distribution.Types.ModuleReexport Methods parsec :: CabalParsing m => m ModuleReexport #
Parsec ModuleRenaming |
Instance details Defined in Distribution.Types.ModuleRenaming Methods parsec :: CabalParsing m => m ModuleRenaming #

Parsec MungedPackageId

    >>> simpleParsec "foo-bar-0" :: Maybe MungedPackageId
    Just (MungedPackageId {mungedName = MungedPackageName (PackageName "foo-bar") LMainLibName, mungedVersion = mkVersion [0]})

    >>> simpleParsec "foo-bar" :: Maybe MungedPackageId
    Just (MungedPackageId {mungedName = MungedPackageName (PackageName "foo-bar") LMainLibName, mungedVersion = mkVersion []})

    >>> simpleParsec "z-foo-bar-z-baz-0" :: Maybe MungedPackageId
    Just (MungedPackageId {mungedName = MungedPackageName (PackageName "foo-bar") (LSubLibName (UnqualComponentName "baz")), mungedVersion = mkVersion [0]})

    >>> simpleParsec "foo-bar-0-0" :: Maybe MungedPackageId
    Nothing

    >>> simpleParsec "foo-bar.0" :: Maybe MungedPackageId
    Nothing

    >>> simpleParsec "foo-bar.4-2" :: Maybe MungedPackageId
    Nothing

Instance details Defined in Distribution.Types.MungedPackageId Methods parsec :: CabalParsing m => m MungedPackageId #

Parsec MungedPackageName

    >>> simpleParsec "servant" :: Maybe MungedPackageName
    Just (MungedPackageName (PackageName "servant") LMainLibName)

    >>> simpleParsec "z-servant-z-lackey" :: Maybe MungedPackageName
    Just (MungedPackageName (PackageName "servant") (LSubLibName (UnqualComponentName "lackey")))

    >>> simpleParsec "z-servant-zz" :: Maybe MungedPackageName
    Just (MungedPackageName (PackageName "z-servant-zz") LMainLibName)

Instance details Defined in Distribution.Types.MungedPackageName Methods parsec :: CabalParsing m => m MungedPackageName #

Parsec PackageIdentifier

    >>> simpleParsec "foo-bar-0" :: Maybe PackageIdentifier
    Just (PackageIdentifier {pkgName = PackageName "foo-bar", pkgVersion = mkVersion [0]})

    >>> simpleParsec "foo-bar" :: Maybe PackageIdentifier
    Just (PackageIdentifier {pkgName = PackageName "foo-bar", pkgVersion = mkVersion []})

Note: Stricter than `Text` instance

    >>> simpleParsec "foo-bar-0-0" :: Maybe PackageIdentifier
    Nothing

    >>> simpleParsec "foo-bar.0" :: Maybe PackageIdentifier
    Nothing

    >>> simpleParsec "foo-bar.4-2" :: Maybe PackageIdentifier
    Nothing

    >>> simpleParsec "1.2.3" :: Maybe PackageIdentifier
    Nothing

Instance details Defined in Distribution.Types.PackageId Methods parsec :: CabalParsing m => m PackageIdentifier #
Parsec PackageName |
Instance details Defined in Distribution.Types.PackageName Methods parsec :: CabalParsing m => m PackageName #

Parsec PackageVersionConstraint

    >>> simpleParsec "foo" :: Maybe PackageVersionConstraint
    Just (PackageVersionConstraint (PackageName "foo") (OrLaterVersion (mkVersion [0])))

    >>> simpleParsec "foo >=2.0" :: Maybe PackageVersionConstraint
    Just (PackageVersionConstraint (PackageName "foo") (OrLaterVersion (mkVersion [2,0])))

    >>> simpleParsec "foo-2.0" :: Maybe PackageVersionConstraint
    Just (PackageVersionConstraint (PackageName "foo") (ThisVersion (mkVersion [2,0])))

Instance details Defined in Distribution.Types.PackageVersionConstraint Methods parsec :: CabalParsing m => m PackageVersionConstraint #
Parsec PkgconfigDependency |
Instance details Defined in Distribution.Types.PkgconfigDependency Methods parsec :: CabalParsing m => m PkgconfigDependency #
Parsec PkgconfigName |
Instance details Defined in Distribution.Types.PkgconfigName Methods parsec :: CabalParsing m => m PkgconfigName #

Parsec PkgconfigVersion

    >>> simpleParsec "1.0.2n" :: Maybe PkgconfigVersion
    Just (PkgconfigVersion "1.0.2n")

    >>> simpleParsec "0.3.5+ds" :: Maybe PkgconfigVersion
    Nothing

Instance details Defined in Distribution.Types.PkgconfigVersion Methods parsec :: CabalParsing m => m PkgconfigVersion #
Parsec PkgconfigVersionRange |
Instance details Defined in Distribution.Types.PkgconfigVersionRange Methods parsec :: CabalParsing m => m PkgconfigVersionRange #
Parsec KnownRepoType |
Instance details Defined in Distribution.Types.SourceRepo Methods parsec :: CabalParsing m => m KnownRepoType #
Parsec RepoKind |
Instance details Defined in Distribution.Types.SourceRepo Methods parsec :: CabalParsing m => m RepoKind #
Parsec RepoType |
Instance details Defined in Distribution.Types.SourceRepo Methods parsec :: CabalParsing m => m RepoType #
Parsec TestType |
Instance details Defined in Distribution.Types.TestType Methods parsec :: CabalParsing m => m TestType #
Parsec DefUnitId |
Instance details Defined in Distribution.Types.UnitId Methods parsec :: CabalParsing m => m DefUnitId #
Parsec UnitId | The textual format for `UnitId` coincides with the format GHC accepts for `-package-id`.
Instance details Defined in Distribution.Types.UnitId Methods parsec :: CabalParsing m => m UnitId #
Parsec UnqualComponentName |
Instance details Defined in Distribution.Types.UnqualComponentName Methods parsec :: CabalParsing m => m UnqualComponentName #
Parsec Version |
Instance details Defined in Distribution.Types.Version Methods parsec :: CabalParsing m => m Version #

Parsec VersionRange

    >>> simpleParsec "^>= 3.4" :: Maybe VersionRange
    Just (MajorBoundVersion (mkVersion [3,4]))

Small history:

`-any` and `-none` removed in 3.4 Use `>=0` and `<0` instead.

    >>> map (`simpleParsec'` "-none") [CabalSpecV3_0, CabalSpecV3_4] :: [Maybe VersionRange]
    [Just (EarlierVersion (mkVersion [0])),Nothing]

Set operations are introduced in 3.0

    >>> map (`simpleParsec'` "^>= { 1.2 , 1.3 }") [CabalSpecV2_4, CabalSpecV3_0] :: [Maybe VersionRange]
    [Nothing,Just (UnionVersionRanges (MajorBoundVersion (mkVersion [1,2])) (MajorBoundVersion (mkVersion [1,3])))]

`^>=` is introduced in 2.0

    >>> map (`simpleParsec'` "^>=1.2") [CabalSpecV1_24, CabalSpecV2_0] :: [Maybe VersionRange]
    [Nothing,Just (MajorBoundVersion (mkVersion [1,2]))]

`-none` is introduced in 1.22

    >>> map (`simpleParsec'` "-none") [CabalSpecV1_20, CabalSpecV1_22] :: [Maybe VersionRange]
    [Nothing,Just (EarlierVersion (mkVersion [0]))]

Operators are introduced in 1.8. Issues only a warning.

    >>> map (`simpleParsecW'` "== 1 || ==2") [CabalSpecV1_6, CabalSpecV1_8] :: [Maybe VersionRange]
    [Nothing,Just (UnionVersionRanges (ThisVersion (mkVersion [1])) (ThisVersion (mkVersion [2])))]

Wild-version ranges are introduced in 1.6. Issues only a warning.

    >>> map (`simpleParsecW'` "== 1.2.*") [CabalSpecV1_4, CabalSpecV1_6] :: [Maybe VersionRange]
    [Nothing,Just (IntersectVersionRanges (OrLaterVersion (mkVersion [1,2])) (EarlierVersion (mkVersion [1,3])))]

Instance details Defined in Distribution.Types.VersionRange.Internal Methods parsec :: CabalParsing m => m VersionRange #
Parsec Extension |
Instance details Defined in Language.Haskell.Extension Methods parsec :: CabalParsing m => m Extension #
Parsec Language |
Instance details Defined in Language.Haskell.Extension Methods parsec :: CabalParsing m => m Language #
Parsec InstallOutcome # |
Instance details Defined in Distribution.Client.BuildReports.Types Methods parsec :: CabalParsing m => m InstallOutcome #
Parsec Outcome # |
Instance details Defined in Distribution.Client.BuildReports.Types Methods parsec :: CabalParsing m => m Outcome #
Parsec ReportLevel # |
Instance details Defined in Distribution.Client.BuildReports.Types Methods parsec :: CabalParsing m => m ReportLevel #
Parsec PreSolver # |
Instance details Defined in Distribution.Client.Dependency.Types Methods parsec :: CabalParsing m => m PreSolver #
Parsec FilePathRoot # |
Instance details Defined in Distribution.Client.Glob Methods parsec :: CabalParsing m => m FilePathRoot #
Parsec RootedGlob # |
Instance details Defined in Distribution.Client.Glob Methods parsec :: CabalParsing m => m RootedGlob #
Parsec ActiveRepoEntry # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods parsec :: CabalParsing m => m ActiveRepoEntry #

Parsec ActiveRepos #

Note: empty string is not valid `ActiveRepos`.

    >>> simpleParsec "" :: Maybe ActiveRepos
    Nothing

    >>> simpleParsec ":none" :: Maybe ActiveRepos
    Just (ActiveRepos [])

    >>> simpleParsec ":rest" :: Maybe ActiveRepos
    Just (ActiveRepos [ActiveRepoRest CombineStrategyMerge])

    >>> simpleParsec "hackage.haskell.org, :rest, head.hackage:override" :: Maybe ActiveRepos
    Just (ActiveRepos [ActiveRepo (RepoName {unRepoName = "hackage.haskell.org"}) CombineStrategyMerge,ActiveRepoRest CombineStrategyMerge,ActiveRepo (RepoName {unRepoName = "head.hackage"}) CombineStrategyOverride])

Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods parsec :: CabalParsing m => m ActiveRepos #
Parsec CombineStrategy # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods parsec :: CabalParsing m => m CombineStrategy #
Parsec RepoIndexState # |
Instance details Defined in Distribution.Client.IndexUtils.IndexState Methods parsec :: CabalParsing m => m RepoIndexState #

Parsec TotalIndexState #

    >>> simpleParsec "HEAD" :: Maybe TotalIndexState
    Just (TIS IndexStateHead (fromList []))

    >>> simpleParsec "" :: Maybe TotalIndexState
    Nothing

    >>> simpleParsec "hackage.haskell.org HEAD" :: Maybe TotalIndexState
    Just (TIS IndexStateHead (fromList []))

    >>> simpleParsec "2020-02-04T12:34:56Z, hackage.haskell.org HEAD" :: Maybe TotalIndexState
    Just (TIS (IndexStateTime (TS 1580819696)) (fromList [(RepoName {unRepoName = "hackage.haskell.org"},IndexStateHead)]))

    >>> simpleParsec "hackage.haskell.org 2020-02-04T12:34:56Z" :: Maybe TotalIndexState
    Just (TIS IndexStateHead (fromList [(RepoName {unRepoName = "hackage.haskell.org"},IndexStateTime (TS 1580819696))]))

Instance details Defined in Distribution.Client.IndexUtils.IndexState Methods parsec :: CabalParsing m => m TotalIndexState #
Parsec Timestamp # |
Instance details Defined in Distribution.Client.IndexUtils.Timestamp Methods parsec :: CabalParsing m => m Timestamp #
Parsec UserConstraint # |
Instance details Defined in Distribution.Client.Targets Methods parsec :: CabalParsing m => m UserConstraint #
Parsec RelaxDepSubject # |
Instance details Defined in Distribution.Client.Types.AllowNewer Methods parsec :: CabalParsing m => m RelaxDepSubject #

Parsec RelaxDeps #

    >>> simpleParsec "all" :: Maybe RelaxDeps
    Just RelaxDepsAll

    >>> simpleParsec "none" :: Maybe RelaxDeps
    Just (RelaxDepsSome [])

    >>> simpleParsec "*, *" :: Maybe RelaxDeps
    Just RelaxDepsAll

    >>> simpleParsec "*:*" :: Maybe RelaxDeps
    Just RelaxDepsAll

    >>> simpleParsec "foo:bar, quu:puu" :: Maybe RelaxDeps
    Just (RelaxDepsSome [RelaxedDep (RelaxDepScopePackage (PackageName "foo")) RelaxDepModNone (RelaxDepSubjectPkg (PackageName "bar")),RelaxedDep (RelaxDepScopePackage (PackageName "quu")) RelaxDepModNone (RelaxDepSubjectPkg (PackageName "puu"))])

This is not a glitch, even it looks like:

    >>> simpleParsec ", all" :: Maybe RelaxDeps
    Just RelaxDepsAll

    >>> simpleParsec "" :: Maybe RelaxDeps
    Nothing

Instance details Defined in Distribution.Client.Types.AllowNewer Methods parsec :: CabalParsing m => m RelaxDeps #
Parsec RelaxedDep # |
Instance details Defined in Distribution.Client.Types.AllowNewer Methods parsec :: CabalParsing m => m RelaxedDep #
Parsec InstallMethod # |
Instance details Defined in Distribution.Client.Types.InstallMethod Methods parsec :: CabalParsing m => m InstallMethod #
Parsec OverwritePolicy # |
Instance details Defined in Distribution.Client.Types.OverwritePolicy Methods parsec :: CabalParsing m => m OverwritePolicy #
Parsec LocalRepo # | Note: doesn't parse `localRepoSharedCache` field.
Instance details Defined in Distribution.Client.Types.Repo Methods parsec :: CabalParsing m => m LocalRepo #
Parsec RemoteRepo # | Note: serialised format represents `RemoteRepo` only partially.
Instance details Defined in Distribution.Client.Types.Repo Methods parsec :: CabalParsing m => m RemoteRepo #

Parsec RepoName #

    >>> simpleParsec "hackage.haskell.org" :: Maybe RepoName
    Just (RepoName {unRepoName = "hackage.haskell.org"})

    >>> simpleParsec "0123" :: Maybe RepoName
    Nothing

Instance details Defined in Distribution.Client.Types.RepoName Methods parsec :: CabalParsing m => m RepoName #
Parsec OnlyConstrained |
Instance details Defined in Distribution.Solver.Types.Settings Methods parsec :: CabalParsing m => m OnlyConstrained #
Parsec Bool |
Instance details Defined in Distribution.Parsec Methods parsec :: CabalParsing m => m Bool #
Parsec a => Parsec (MQuoted a) |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods parsec :: CabalParsing m => m (MQuoted a) #
Parsec a => Parsec (Identity a) |
Instance details Defined in Distribution.Parsec Methods parsec :: CabalParsing m => m (Identity a) #
Parsec (SymbolicPath from to) |
Instance details Defined in Distribution.Utils.Path Methods parsec :: CabalParsing m => m (SymbolicPath from to) #
(Newtype a b, Sep sep, Parsec b) => Parsec (List sep b a) |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods parsec :: CabalParsing m => m (List sep b a) #
(Newtype a b, Sep sep, Parsec b) => Parsec (NonEmpty' sep b a) |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods parsec :: CabalParsing m => m (NonEmpty' sep b a) #
(Newtype a b, Ord a, Sep sep, Parsec b) => Parsec (Set' sep b a) |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods parsec :: CabalParsing m => m (Set' sep b a) #

class Pretty a where #

Minimal complete definition

pretty

Methods

pretty :: a -> Doc #

prettyVersioned :: CabalSpecVersion -> a -> Doc #

#### Instances

Instances details

Pretty Glob |
Instance details Defined in Distribution.Simple.Glob.Internal Methods pretty :: Glob -> Doc # prettyVersioned :: CabalSpecVersion -> Glob -> Doc #
Pretty Suffix |
Instance details Defined in Distribution.Simple.PreProcess.Types Methods pretty :: Suffix -> Doc # prettyVersioned :: CabalSpecVersion -> Suffix -> Doc #
Pretty HaddockTarget |
Instance details Defined in Distribution.Simple.Setup.Haddock Methods pretty :: HaddockTarget -> Doc # prettyVersioned :: CabalSpecVersion -> HaddockTarget -> Doc #
Pretty TestShowDetails |
Instance details Defined in Distribution.Simple.Setup.Test Methods pretty :: TestShowDetails -> Doc # prettyVersioned :: CabalSpecVersion -> TestShowDetails -> Doc #
Pretty Verbosity |
Instance details Defined in Distribution.Verbosity Methods pretty :: Verbosity -> Doc # prettyVersioned :: CabalSpecVersion -> Verbosity -> 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 AbiTag |
Instance details Defined in Distribution.Compiler Methods pretty :: AbiTag -> Doc # prettyVersioned :: CabalSpecVersion -> AbiTag -> Doc #
Pretty CompilerFlavor |
Instance details Defined in Distribution.Compiler Methods pretty :: CompilerFlavor -> Doc # prettyVersioned :: CabalSpecVersion -> CompilerFlavor -> Doc #
Pretty CompilerId |
Instance details Defined in Distribution.Compiler Methods pretty :: CompilerId -> Doc # prettyVersioned :: CabalSpecVersion -> CompilerId -> Doc #
Pretty FilePathNT |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods pretty :: FilePathNT -> Doc # prettyVersioned :: CabalSpecVersion -> FilePathNT -> Doc #
Pretty SpecLicense |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods pretty :: SpecLicense -> Doc # prettyVersioned :: CabalSpecVersion -> SpecLicense -> Doc #
Pretty SpecVersion |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods pretty :: SpecVersion -> Doc # prettyVersioned :: CabalSpecVersion -> SpecVersion -> Doc #
Pretty TestedWith |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods pretty :: TestedWith -> Doc # prettyVersioned :: CabalSpecVersion -> TestedWith -> Doc #
Pretty Token |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods pretty :: Token -> Doc # prettyVersioned :: CabalSpecVersion -> Token -> Doc #
Pretty Token' |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods pretty :: Token' -> Doc # prettyVersioned :: CabalSpecVersion -> Token' -> Doc #
Pretty License |
Instance details Defined in Distribution.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 CompatFilePath |
Instance details Defined in Distribution.PackageDescription.FieldGrammar Methods pretty :: CompatFilePath -> Doc # prettyVersioned :: CabalSpecVersion -> CompatFilePath -> Doc #
Pretty CompatLicenseFile |
Instance details Defined in Distribution.PackageDescription.FieldGrammar Methods pretty :: CompatLicenseFile -> Doc # prettyVersioned :: CabalSpecVersion -> CompatLicenseFile -> Doc #
Pretty License |
Instance details Defined in Distribution.SPDX.License Methods pretty :: License -> Doc # prettyVersioned :: CabalSpecVersion -> License -> Doc #
Pretty LicenseExceptionId |
Instance details Defined in Distribution.SPDX.LicenseExceptionId Methods pretty :: LicenseExceptionId -> Doc # prettyVersioned :: CabalSpecVersion -> LicenseExceptionId -> Doc #
Pretty LicenseExpression |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods pretty :: LicenseExpression -> Doc # prettyVersioned :: CabalSpecVersion -> LicenseExpression -> Doc #
Pretty SimpleLicenseExpression |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods pretty :: SimpleLicenseExpression -> Doc # prettyVersioned :: CabalSpecVersion -> SimpleLicenseExpression -> Doc #
Pretty LicenseId |
Instance details Defined in Distribution.SPDX.LicenseId Methods pretty :: LicenseId -> Doc # prettyVersioned :: CabalSpecVersion -> LicenseId -> Doc #
Pretty LicenseRef |
Instance details Defined in Distribution.SPDX.LicenseReference Methods pretty :: LicenseRef -> Doc # prettyVersioned :: CabalSpecVersion -> LicenseRef -> 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 Platform |
Instance details Defined in Distribution.System Methods pretty :: Platform -> Doc # prettyVersioned :: CabalSpecVersion -> Platform -> Doc #
Pretty AbiDependency |
Instance details Defined in Distribution.Types.AbiDependency Methods pretty :: AbiDependency -> Doc # prettyVersioned :: CabalSpecVersion -> AbiDependency -> Doc #
Pretty AbiHash |
Instance details Defined in Distribution.Types.AbiHash Methods pretty :: AbiHash -> Doc # prettyVersioned :: CabalSpecVersion -> AbiHash -> Doc #
Pretty BenchmarkType |
Instance details Defined in Distribution.Types.BenchmarkType Methods pretty :: BenchmarkType -> Doc # prettyVersioned :: CabalSpecVersion -> BenchmarkType -> Doc #
Pretty BuildType |
Instance details Defined in Distribution.Types.BuildType Methods pretty :: BuildType -> Doc # prettyVersioned :: CabalSpecVersion -> BuildType -> Doc #
Pretty ComponentId |
Instance details Defined in Distribution.Types.ComponentId Methods pretty :: ComponentId -> Doc # prettyVersioned :: CabalSpecVersion -> ComponentId -> Doc #
Pretty ComponentName |
Instance details Defined in Distribution.Types.ComponentName Methods pretty :: ComponentName -> Doc # prettyVersioned :: CabalSpecVersion -> ComponentName -> Doc #

Pretty Dependency

    >>> 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}"

Instance details Defined in Distribution.Types.Dependency Methods pretty :: Dependency -> Doc # prettyVersioned :: CabalSpecVersion -> Dependency -> Doc #
Pretty ExeDependency |
Instance details Defined in Distribution.Types.ExeDependency Methods pretty :: ExeDependency -> Doc # prettyVersioned :: CabalSpecVersion -> ExeDependency -> Doc #
Pretty ExecutableScope |
Instance details Defined in Distribution.Types.ExecutableScope Methods pretty :: ExecutableScope -> Doc # prettyVersioned :: CabalSpecVersion -> ExecutableScope -> Doc #
Pretty ExposedModule |
Instance details Defined in Distribution.Types.ExposedModule Methods pretty :: ExposedModule -> Doc # prettyVersioned :: CabalSpecVersion -> ExposedModule -> Doc #
Pretty FlagAssignment | Since: Cabal-syntax-3.4.0.0
Instance details Defined in Distribution.Types.Flag Methods pretty :: FlagAssignment -> Doc # prettyVersioned :: CabalSpecVersion -> FlagAssignment -> Doc #
Pretty FlagName |
Instance details Defined in Distribution.Types.Flag Methods pretty :: FlagName -> Doc # prettyVersioned :: CabalSpecVersion -> FlagName -> Doc #
Pretty LibVersionInfo |
Instance details Defined in Distribution.Types.ForeignLib Methods pretty :: LibVersionInfo -> Doc # prettyVersioned :: CabalSpecVersion -> LibVersionInfo -> Doc #
Pretty ForeignLibOption |
Instance details Defined in Distribution.Types.ForeignLibOption Methods pretty :: ForeignLibOption -> Doc # prettyVersioned :: CabalSpecVersion -> ForeignLibOption -> Doc #
Pretty ForeignLibType |
Instance details Defined in Distribution.Types.ForeignLibType Methods pretty :: ForeignLibType -> Doc # prettyVersioned :: CabalSpecVersion -> ForeignLibType -> Doc #
Pretty IncludeRenaming |
Instance details Defined in Distribution.Types.IncludeRenaming Methods pretty :: IncludeRenaming -> Doc # prettyVersioned :: CabalSpecVersion -> IncludeRenaming -> Doc #
Pretty CompatPackageKey |
Instance details Defined in Distribution.Types.InstalledPackageInfo.FieldGrammar Methods pretty :: CompatPackageKey -> Doc # prettyVersioned :: CabalSpecVersion -> CompatPackageKey -> Doc #
Pretty ExposedModules |
Instance details Defined in Distribution.Types.InstalledPackageInfo.FieldGrammar Methods pretty :: ExposedModules -> Doc # prettyVersioned :: CabalSpecVersion -> ExposedModules -> Doc #
Pretty InstWith |
Instance details Defined in Distribution.Types.InstalledPackageInfo.FieldGrammar Methods pretty :: InstWith -> Doc # prettyVersioned :: CabalSpecVersion -> InstWith -> Doc #
Pretty SpecLicenseLenient |
Instance details Defined in Distribution.Types.InstalledPackageInfo.FieldGrammar Methods pretty :: SpecLicenseLenient -> Doc # prettyVersioned :: CabalSpecVersion -> SpecLicenseLenient -> Doc #
Pretty LegacyExeDependency |
Instance details Defined in Distribution.Types.LegacyExeDependency Methods pretty :: LegacyExeDependency -> Doc # prettyVersioned :: CabalSpecVersion -> LegacyExeDependency -> Doc #
Pretty LibraryVisibility |
Instance details Defined in Distribution.Types.LibraryVisibility Methods pretty :: LibraryVisibility -> Doc # prettyVersioned :: CabalSpecVersion -> LibraryVisibility -> Doc #
Pretty Mixin |
Instance details Defined in Distribution.Types.Mixin Methods pretty :: Mixin -> Doc # prettyVersioned :: CabalSpecVersion -> Mixin -> Doc #
Pretty Module |
Instance details Defined in Distribution.Types.Module Methods pretty :: Module -> Doc # prettyVersioned :: CabalSpecVersion -> Module -> Doc #
Pretty ModuleReexport |
Instance details Defined in Distribution.Types.ModuleReexport Methods pretty :: ModuleReexport -> Doc # prettyVersioned :: CabalSpecVersion -> ModuleReexport -> Doc #
Pretty ModuleRenaming |
Instance details Defined in Distribution.Types.ModuleRenaming Methods pretty :: ModuleRenaming -> Doc # prettyVersioned :: CabalSpecVersion -> ModuleRenaming -> 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 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 PackageIdentifier |
Instance details Defined in Distribution.Types.PackageId Methods pretty :: PackageIdentifier -> Doc # prettyVersioned :: CabalSpecVersion -> PackageIdentifier -> Doc #
Pretty PackageName |
Instance details Defined in Distribution.Types.PackageName Methods pretty :: PackageName -> Doc # prettyVersioned :: CabalSpecVersion -> PackageName -> Doc #
Pretty PackageVersionConstraint |
Instance details Defined in Distribution.Types.PackageVersionConstraint Methods pretty :: PackageVersionConstraint -> Doc # prettyVersioned :: CabalSpecVersion -> PackageVersionConstraint -> Doc #
Pretty PkgconfigDependency |
Instance details Defined in Distribution.Types.PkgconfigDependency Methods pretty :: PkgconfigDependency -> Doc # prettyVersioned :: CabalSpecVersion -> PkgconfigDependency -> Doc #
Pretty PkgconfigName |
Instance details Defined in Distribution.Types.PkgconfigName Methods pretty :: PkgconfigName -> Doc # prettyVersioned :: CabalSpecVersion -> PkgconfigName -> 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 KnownRepoType |
Instance details Defined in Distribution.Types.SourceRepo Methods pretty :: KnownRepoType -> Doc # prettyVersioned :: CabalSpecVersion -> KnownRepoType -> Doc #
Pretty RepoKind |
Instance details Defined in Distribution.Types.SourceRepo Methods pretty :: RepoKind -> Doc # prettyVersioned :: CabalSpecVersion -> RepoKind -> Doc #
Pretty RepoType |
Instance details Defined in Distribution.Types.SourceRepo Methods pretty :: RepoType -> Doc # prettyVersioned :: CabalSpecVersion -> RepoType -> Doc #
Pretty TestType |
Instance details Defined in Distribution.Types.TestType Methods pretty :: TestType -> Doc # prettyVersioned :: CabalSpecVersion -> TestType -> 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 UnqualComponentName |
Instance details Defined in Distribution.Types.UnqualComponentName Methods pretty :: UnqualComponentName -> Doc # prettyVersioned :: CabalSpecVersion -> UnqualComponentName -> Doc #
Pretty Version |
Instance details Defined in Distribution.Types.Version Methods pretty :: Version -> Doc # prettyVersioned :: CabalSpecVersion -> Version -> Doc #

Pretty VersionRange

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

Instance details Defined in Distribution.Types.VersionRange.Internal Methods pretty :: VersionRange -> Doc # prettyVersioned :: CabalSpecVersion -> VersionRange -> Doc #
Pretty Extension |
Instance details Defined in Language.Haskell.Extension Methods pretty :: Extension -> Doc # prettyVersioned :: CabalSpecVersion -> Extension -> Doc #
Pretty KnownExtension |
Instance details Defined in Language.Haskell.Extension Methods pretty :: KnownExtension -> Doc # prettyVersioned :: CabalSpecVersion -> KnownExtension -> Doc #
Pretty Language |
Instance details Defined in Language.Haskell.Extension Methods pretty :: Language -> Doc # prettyVersioned :: CabalSpecVersion -> Language -> Doc #
Pretty InstallOutcome # |
Instance details Defined in Distribution.Client.BuildReports.Types Methods pretty :: InstallOutcome -> Doc # prettyVersioned :: CabalSpecVersion -> InstallOutcome -> Doc #
Pretty Outcome # |
Instance details Defined in Distribution.Client.BuildReports.Types Methods pretty :: Outcome -> Doc # prettyVersioned :: CabalSpecVersion -> Outcome -> Doc #
Pretty ReportLevel # |
Instance details Defined in Distribution.Client.BuildReports.Types Methods pretty :: ReportLevel -> Doc # prettyVersioned :: CabalSpecVersion -> ReportLevel -> Doc #
Pretty PreSolver # |
Instance details Defined in Distribution.Client.Dependency.Types Methods pretty :: PreSolver -> Doc # prettyVersioned :: CabalSpecVersion -> PreSolver -> Doc #
Pretty FilePathRoot # |
Instance details Defined in Distribution.Client.Glob Methods pretty :: FilePathRoot -> Doc # prettyVersioned :: CabalSpecVersion -> FilePathRoot -> Doc #
Pretty RootedGlob # |
Instance details Defined in Distribution.Client.Glob Methods pretty :: RootedGlob -> Doc # prettyVersioned :: CabalSpecVersion -> RootedGlob -> Doc #
Pretty ActiveRepoEntry # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods pretty :: ActiveRepoEntry -> Doc # prettyVersioned :: CabalSpecVersion -> ActiveRepoEntry -> Doc #
Pretty ActiveRepos # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods pretty :: ActiveRepos -> Doc # prettyVersioned :: CabalSpecVersion -> ActiveRepos -> Doc #
Pretty CombineStrategy # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods pretty :: CombineStrategy -> Doc # prettyVersioned :: CabalSpecVersion -> CombineStrategy -> Doc #
Pretty RepoIndexState # |
Instance details Defined in Distribution.Client.IndexUtils.IndexState Methods pretty :: RepoIndexState -> Doc # prettyVersioned :: CabalSpecVersion -> RepoIndexState -> Doc #
Pretty TotalIndexState # |
Instance details Defined in Distribution.Client.IndexUtils.IndexState Methods pretty :: TotalIndexState -> Doc # prettyVersioned :: CabalSpecVersion -> TotalIndexState -> Doc #
Pretty Timestamp # |
Instance details Defined in Distribution.Client.IndexUtils.Timestamp Methods pretty :: Timestamp -> Doc # prettyVersioned :: CabalSpecVersion -> Timestamp -> Doc #
Pretty UserConstraint # |
Instance details Defined in Distribution.Client.Targets Methods pretty :: UserConstraint -> Doc # prettyVersioned :: CabalSpecVersion -> UserConstraint -> Doc #
Pretty RelaxDepSubject # |
Instance details Defined in Distribution.Client.Types.AllowNewer Methods pretty :: RelaxDepSubject -> Doc # prettyVersioned :: CabalSpecVersion -> RelaxDepSubject -> Doc #
Pretty RelaxDeps # |
Instance details Defined in Distribution.Client.Types.AllowNewer Methods pretty :: RelaxDeps -> Doc # prettyVersioned :: CabalSpecVersion -> RelaxDeps -> Doc #
Pretty RelaxedDep # |
Instance details Defined in Distribution.Client.Types.AllowNewer Methods pretty :: RelaxedDep -> Doc # prettyVersioned :: CabalSpecVersion -> RelaxedDep -> Doc #
Pretty InstallMethod # |
Instance details Defined in Distribution.Client.Types.InstallMethod Methods pretty :: InstallMethod -> Doc # prettyVersioned :: CabalSpecVersion -> InstallMethod -> Doc #
Pretty OverwritePolicy # |
Instance details Defined in Distribution.Client.Types.OverwritePolicy Methods pretty :: OverwritePolicy -> Doc # prettyVersioned :: CabalSpecVersion -> OverwritePolicy -> Doc #
Pretty LocalRepo # |
Instance details Defined in Distribution.Client.Types.Repo Methods pretty :: LocalRepo -> Doc # prettyVersioned :: CabalSpecVersion -> LocalRepo -> Doc #
Pretty RemoteRepo # |
Instance details Defined in Distribution.Client.Types.Repo Methods pretty :: RemoteRepo -> Doc # prettyVersioned :: CabalSpecVersion -> RemoteRepo -> Doc #
Pretty RepoName # |
Instance details Defined in Distribution.Client.Types.RepoName Methods pretty :: RepoName -> Doc # prettyVersioned :: CabalSpecVersion -> RepoName -> Doc #
Pretty Component |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods pretty :: Component -> Doc # prettyVersioned :: CabalSpecVersion -> Component -> Doc #
Pretty OnlyConstrained |
Instance details Defined in Distribution.Solver.Types.Settings Methods pretty :: OnlyConstrained -> Doc # prettyVersioned :: CabalSpecVersion -> OnlyConstrained -> Doc #
Pretty Doc | Since: Cabal-syntax-3.4.0.0
Instance details Defined in Distribution.Pretty Methods pretty :: Doc -> Doc # prettyVersioned :: CabalSpecVersion -> Doc -> Doc #
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 a => Pretty (MQuoted a) |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods pretty :: MQuoted a -> Doc # prettyVersioned :: CabalSpecVersion -> MQuoted a -> Doc #
Pretty a => Pretty (Identity a) |
Instance details Defined in Distribution.Pretty Methods pretty :: Identity a -> Doc # prettyVersioned :: CabalSpecVersion -> Identity a -> Doc #
Pretty (SymbolicPath from to) |
Instance details Defined in Distribution.Utils.Path Methods pretty :: SymbolicPath from to -> Doc # prettyVersioned :: CabalSpecVersion -> SymbolicPath from to -> Doc #
(Newtype a b, Sep sep, Pretty b) => Pretty (List sep b a) |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods pretty :: List sep b a -> Doc # prettyVersioned :: CabalSpecVersion -> List sep b a -> Doc #
(Newtype a b, Sep sep, Pretty b) => Pretty (NonEmpty' sep b a) |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods pretty :: NonEmpty' sep b a -> Doc # prettyVersioned :: CabalSpecVersion -> NonEmpty' sep b a -> Doc #
(Newtype a b, Sep sep, Pretty b) => Pretty (Set' sep b a) |
Instance details Defined in Distribution.FieldGrammar.Newtypes Methods pretty :: Set' sep b a -> Doc # prettyVersioned :: CabalSpecVersion -> Set' sep b a -> Doc #

data Verbosity #

#### Instances

Instances details

Parsec Verbosity

Parser verbosity

    >>> explicitEitherParsec parsecVerbosity "normal"
    Right (Verbosity {vLevel = Normal, vFlags = fromList [], vQuiet = False})

    >>> explicitEitherParsec parsecVerbosity "normal+nowrap  "
    Right (Verbosity {vLevel = Normal, vFlags = fromList [VNoWrap], vQuiet = False})

    >>> explicitEitherParsec parsecVerbosity "normal+nowrap +markoutput"
    Right (Verbosity {vLevel = Normal, vFlags = fromList [VNoWrap,VMarkOutput], vQuiet = False})

    >>> explicitEitherParsec parsecVerbosity "normal +nowrap +markoutput"
    Right (Verbosity {vLevel = Normal, vFlags = fromList [VNoWrap,VMarkOutput], vQuiet = False})

    >>> explicitEitherParsec parsecVerbosity "normal+nowrap+markoutput"
    Right (Verbosity {vLevel = Normal, vFlags = fromList [VNoWrap,VMarkOutput], vQuiet = False})

    >>> explicitEitherParsec parsecVerbosity "deafening+nowrap+stdout+stderr+callsite+callstack"
    Right (Verbosity {vLevel = Deafening, vFlags = fromList [VCallStack,VCallSite,VNoWrap,VStderr], vQuiet = False})

Note: this parser will eat trailing spaces.

Instance details Defined in Distribution.Verbosity Methods parsec :: CabalParsing m => m Verbosity #
Pretty Verbosity |
Instance details Defined in Distribution.Verbosity Methods pretty :: Verbosity -> Doc # prettyVersioned :: CabalSpecVersion -> Verbosity -> Doc #
Structured Verbosity |
Instance details Defined in Distribution.Verbosity Methods structure :: Proxy Verbosity -> Structure # structureHash' :: Tagged Verbosity MD5
Binary Verbosity |
Instance details Defined in Distribution.Verbosity Methods put :: Verbosity -> Put # get :: Get Verbosity # putList :: [Verbosity] -> Put #
Bounded Verbosity |
Instance details Defined in Distribution.Verbosity Methods minBound :: Verbosity # maxBound :: Verbosity #
Enum Verbosity |

Instance details

Defined in Distribution.Verbosity

Methods

succ :: Verbosity -> Verbosity #

pred :: Verbosity -> Verbosity #

toEnum :: Int -> Verbosity #

fromEnum :: Verbosity -> Int #

enumFrom :: Verbosity -> [Verbosity] #

enumFromThen :: Verbosity -> Verbosity -> [Verbosity] #

enumFromTo :: Verbosity -> Verbosity -> [Verbosity] #

enumFromThenTo :: Verbosity -> Verbosity -> Verbosity -> [Verbosity] #

Generic Verbosity |

Instance details

Defined in Distribution.Verbosity

Associated Types

type Rep Verbosity |

Instance details

Defined in Distribution.Verbosity

type Rep Verbosity = D1 ('MetaData "Verbosity" "Distribution.Verbosity" "Cabal-3.12.0.0-inplace" 'False) (C1 ('MetaCons "Verbosity" 'PrefixI 'True) (S1 ('MetaSel ('Just "vLevel") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VerbosityLevel) :*: (S1 ('MetaSel ('Just "vFlags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set VerbosityFlag)) :*: S1 ('MetaSel ('Just "vQuiet") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))

Methods

from :: Verbosity -> Rep Verbosity x #

to :: Rep Verbosity x -> Verbosity #

Read Verbosity |
Instance details Defined in Distribution.Verbosity Methods readsPrec :: Int -> ReadS Verbosity # readList :: ReadS [Verbosity] # readPrec :: ReadPrec Verbosity # readListPrec :: ReadPrec [Verbosity] #
Show Verbosity |
Instance details Defined in Distribution.Verbosity Methods showsPrec :: Int -> Verbosity -> ShowS # show :: Verbosity -> String # showList :: [Verbosity] -> ShowS #
Eq Verbosity |
Instance details Defined in Distribution.Verbosity Methods (==) :: Verbosity -> Verbosity -> Bool # (/=) :: Verbosity -> Verbosity -> Bool #
Ord Verbosity |
Instance details Defined in Distribution.Verbosity Methods compare :: Verbosity -> Verbosity -> Ordering # (<) :: Verbosity -> Verbosity -> Bool # (<=) :: Verbosity -> Verbosity -> Bool # (>) :: Verbosity -> Verbosity -> Bool # (>=) :: Verbosity -> Verbosity -> Bool # max :: Verbosity -> Verbosity -> Verbosity # min :: Verbosity -> Verbosity -> Verbosity #
type Rep Verbosity |

Instance details

Defined in Distribution.Verbosity

type Rep Verbosity = D1 ('MetaData "Verbosity" "Distribution.Verbosity" "Cabal-3.12.0.0-inplace" 'False) (C1 ('MetaCons "Verbosity" 'PrefixI 'True) (S1 ('MetaSel ('Just "vLevel") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VerbosityLevel) :*: (S1 ('MetaSel ('Just "vFlags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set VerbosityFlag)) :*: S1 ('MetaSel ('Just "vQuiet") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))

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

class (CharParsing m, MonadPlus m, MonadFail m) => CabalParsing (m :: Type -> Type) #

Parsing class which

- can report Cabal parser warnings.
- knows `cabal-version` we work with

Minimal complete definition

parsecWarning, askCabalSpecVersion

#### Instances

Instances details

CabalParsing ParsecParser |
Instance details Defined in Distribution.Parsec Methods parsecWarning :: PWarnType -> String -> ParsecParser () # parsecHaskellString :: ParsecParser String # askCabalSpecVersion :: ParsecParser CabalSpecVersion #

simpleParsec :: Parsec a => String -> Maybe a #

Parse a `String` with `lexemeParsec`.

eitherParsec :: Parsec a => String -> Either String a #

Parse a `String` with `lexemeParsec`.

explicitEitherParsec :: ParsecParser a -> String -> Either String a #

Parse a `String` with given `ParsecParser`. Trailing whitespace is accepted.