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

Safe Haskell | None
Language | Haskell2010

Distribution.Solver.Types.PackageConstraint

Description

Per-package constraints. Package constraints must be respected by the solver. Multiple constraints for each package can be given, though obviously it is possible to construct conflicting constraints (eg impossible version range or inconsistent flag assignment).

Synopsis

- data ConstraintScope
  - = ScopeTarget PackageName
  - | ScopeQualified Qualifier PackageName
  - | ScopeAnySetupQualifier PackageName
  - | ScopeAnyQualifier PackageName
- scopeToplevel :: PackageName -> ConstraintScope
- scopeToPackageName :: ConstraintScope -> PackageName
- constraintScopeMatches :: ConstraintScope -> QPN -> Bool
- data PackageProperty
  - = PackagePropertyVersion VersionRange
  - | PackagePropertyInstalled
  - | PackagePropertySource
  - | PackagePropertyFlags FlagAssignment
  - | PackagePropertyStanzas [OptionalStanza]
- dispPackageProperty :: PackageProperty -> Doc
- data PackageConstraint = PackageConstraint ConstraintScope PackageProperty
- dispPackageConstraint :: PackageConstraint -> Doc
- showPackageConstraint :: PackageConstraint -> String
- packageConstraintToDependency :: PackageConstraint -> Maybe PackageVersionConstraint

# Documentation

data ConstraintScope #

Determines to what packages and in what contexts a constraint applies.

Constructors

ScopeTarget PackageName

A scope that applies when the given package is used as a build target. In other words, the scope applies iff a goal has a top-level qualifier and its namespace matches the given package name. A namespace is considered to match a package name when it is either the default namespace (for --no-independent-goals) or it is an independent namespace with the given package name (for --independent-goals).

ScopeQualified Qualifier PackageName | The package with the specified name and qualifier.
ScopeAnySetupQualifier PackageName | The package with the specified name when it has a setup qualifier.
ScopeAnyQualifier PackageName | The package with the specified name regardless of qualifier.

#### Instances

Instances details

Show ConstraintScope # |
Instance details Defined in Distribution.Solver.Types.PackageConstraint Methods showsPrec :: Int -> ConstraintScope -> ShowS # show :: ConstraintScope -> String # showList :: [ConstraintScope] -> ShowS #
Eq ConstraintScope # |
Instance details Defined in Distribution.Solver.Types.PackageConstraint Methods (==) :: ConstraintScope -> ConstraintScope -> Bool # (/=) :: ConstraintScope -> ConstraintScope -> Bool #

scopeToplevel :: PackageName -> ConstraintScope #

Constructor for a common use case: the constraint applies to the package with the specified name when that package is a top-level dependency in the default namespace.

scopeToPackageName :: ConstraintScope -> PackageName #

Returns the package name associated with a constraint scope.

constraintScopeMatches :: ConstraintScope -> QPN -> Bool #

data PackageProperty #

A package property is a logical predicate on packages.

Constructors

PackagePropertyVersion VersionRange |
PackagePropertyInstalled |
PackagePropertySource |
PackagePropertyFlags FlagAssignment |
PackagePropertyStanzas [OptionalStanza] |

#### Instances

Instances details

Structured PackageProperty # |
Instance details Defined in Distribution.Solver.Types.PackageConstraint Methods structure :: Proxy PackageProperty -> Structure # structureHash' :: Tagged PackageProperty MD5
Binary PackageProperty # |
Instance details Defined in Distribution.Solver.Types.PackageConstraint Methods put :: PackageProperty -> Put # get :: Get PackageProperty # putList :: [PackageProperty] -> Put #
Generic PackageProperty # |

Instance details

Defined in Distribution.Solver.Types.PackageConstraint

Associated Types

type Rep PackageProperty |

Instance details

Defined in Distribution.Solver.Types.PackageConstraint

type Rep PackageProperty = D1 ('MetaData "PackageProperty" "Distribution.Solver.Types.PackageConstraint" "cabal-install-solver-3.12.1.0-BcLJX5rVQuejx1qrKAH5j" 'False) ((C1 ('MetaCons "PackagePropertyVersion" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VersionRange)) :+: C1 ('MetaCons "PackagePropertyInstalled" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PackagePropertySource" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PackagePropertyFlags" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FlagAssignment)) :+: C1 ('MetaCons "PackagePropertyStanzas" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [OptionalStanza])))))

Methods

from :: PackageProperty -> Rep PackageProperty x #

to :: Rep PackageProperty x -> PackageProperty #

Show PackageProperty # |
Instance details Defined in Distribution.Solver.Types.PackageConstraint Methods showsPrec :: Int -> PackageProperty -> ShowS # show :: PackageProperty -> String # showList :: [PackageProperty] -> ShowS #
Eq PackageProperty # |
Instance details Defined in Distribution.Solver.Types.PackageConstraint Methods (==) :: PackageProperty -> PackageProperty -> Bool # (/=) :: PackageProperty -> PackageProperty -> Bool #
type Rep PackageProperty # |

Instance details

Defined in Distribution.Solver.Types.PackageConstraint

type Rep PackageProperty = D1 ('MetaData "PackageProperty" "Distribution.Solver.Types.PackageConstraint" "cabal-install-solver-3.12.1.0-BcLJX5rVQuejx1qrKAH5j" 'False) ((C1 ('MetaCons "PackagePropertyVersion" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VersionRange)) :+: C1 ('MetaCons "PackagePropertyInstalled" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PackagePropertySource" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PackagePropertyFlags" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FlagAssignment)) :+: C1 ('MetaCons "PackagePropertyStanzas" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [OptionalStanza])))))

dispPackageProperty :: PackageProperty -> Doc #

Pretty-prints a package property.

data PackageConstraint #

A package constraint consists of a scope plus a property that must hold for all packages within that scope.

Constructors

PackageConstraint ConstraintScope PackageProperty |

#### Instances

Instances details

Show PackageConstraint # |
Instance details Defined in Distribution.Solver.Types.PackageConstraint Methods showsPrec :: Int -> PackageConstraint -> ShowS # show :: PackageConstraint -> String # showList :: [PackageConstraint] -> ShowS #
Eq PackageConstraint # |
Instance details Defined in Distribution.Solver.Types.PackageConstraint Methods (==) :: PackageConstraint -> PackageConstraint -> Bool # (/=) :: PackageConstraint -> PackageConstraint -> Bool #

dispPackageConstraint :: PackageConstraint -> Doc #

Pretty-prints a package constraint.

showPackageConstraint :: PackageConstraint -> String #

Alternative textual representation of a package constraint for debugging purposes (slightly more verbose than that produced by `dispPackageConstraint`).

packageConstraintToDependency :: PackageConstraint -> Maybe PackageVersionConstraint #

Lossily convert a `PackageConstraint` to a `Dependency`.