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

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

scopeToplevel :: PackageName -> ConstraintScope Source #

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

Returns the package name associated with a constraint scope.

constraintScopeMatches :: ConstraintScope -> QPN -> Bool Source #

data PackageProperty Source #

A package property is a logical predicate on packages.

Constructors

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

#### Instances

Instances details

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

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-5dSETZK2idVHohhzkfJS3u" '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 Source #

to :: Rep PackageProperty x -> PackageProperty Source #

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

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-5dSETZK2idVHohhzkfJS3u" '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 Source #

Pretty-prints a package property.

data PackageConstraint Source #

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

dispPackageConstraint :: PackageConstraint -> Doc Source #

Pretty-prints a package constraint.

showPackageConstraint :: PackageConstraint -> String Source #

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

packageConstraintToDependency :: PackageConstraint -> Maybe PackageVersionConstraint Source #

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