cabal-install-3.10.1.0: The command-line interface for Cabal and Hackage.
Copyright(c) Duncan Coutts 2011
LicenseBSD-like
Maintainerduncan@community.haskell.org
Safe HaskellSafe-Inferred
LanguageHaskell2010

Distribution.Client.Targets

Description

Handling for user-specified targets

Synopsis

User targets

data UserTarget Source #

Various ways that a user may specify a package or package collection.

Constructors

UserTargetNamed PackageVersionConstraint

A partially specified package, identified by name and possibly with an exact version or a version constraint.

cabal install foo
cabal install foo-1.0
cabal install 'foo < 2'
UserTargetLocalDir FilePath

A specific package that is unpacked in a local directory, often the current directory.

cabal install .
cabal install ../lib/other
  • Note: in future, if multiple .cabal files are allowed in a single directory then this will refer to the collection of packages.
UserTargetLocalCabalFile FilePath

A specific local unpacked package, identified by its .cabal file.

cabal install foo.cabal
cabal install ../lib/other/bar.cabal
UserTargetLocalTarball FilePath

A specific package that is available as a local tarball file

cabal install dist/foo-1.0.tar.gz
cabal install ../build/baz-1.0.tar.gz
UserTargetRemoteTarball URI

A specific package that is available as a remote tarball file

cabal install http://code.haskell.org/~user/foo/foo-0.9.tar.gz

Instances

Instances details
Show UserTarget Source # 
Instance details

Defined in Distribution.Client.Targets

Eq UserTarget Source # 
Instance details

Defined in Distribution.Client.Targets

Resolving user targets to package specifiers

resolveUserTargets :: Package pkg => Verbosity -> RepoContext -> PackageIndex pkg -> [UserTarget] -> IO [PackageSpecifier UnresolvedSourcePackage] Source #

Given a bunch of user-specified targets, try to resolve what it is they refer to. They can either be specific packages (local dirs, tarballs etc) or they can be named packages (with or without version info).

Detailed interface

expandUserTarget :: Verbosity -> UserTarget -> IO [PackageTarget (PackageLocation ())] Source #

Given a user-specified target, expand it to a bunch of package targets (each of which refers to only one package).

data PackageTarget pkg Source #

An intermediate between a UserTarget and a resolved PackageSpecifier. Unlike a UserTarget, a PackageTarget refers only to a single package.

Constructors

PackageTargetNamed PackageName [PackageProperty] UserTarget 
PackageTargetNamedFuzzy PackageName [PackageProperty] UserTarget

A package identified by name, but case insensitively, so it needs to be resolved to the right case-sensitive name.

PackageTargetLocation pkg 

Instances

Instances details
Foldable PackageTarget Source # 
Instance details

Defined in Distribution.Client.Targets

Methods

fold :: Monoid m => PackageTarget m -> m #

foldMap :: Monoid m => (a -> m) -> PackageTarget a -> m #

foldMap' :: Monoid m => (a -> m) -> PackageTarget a -> m #

foldr :: (a -> b -> b) -> b -> PackageTarget a -> b #

foldr' :: (a -> b -> b) -> b -> PackageTarget a -> b #

foldl :: (b -> a -> b) -> b -> PackageTarget a -> b #

foldl' :: (b -> a -> b) -> b -> PackageTarget a -> b #

foldr1 :: (a -> a -> a) -> PackageTarget a -> a #

foldl1 :: (a -> a -> a) -> PackageTarget a -> a #

toList :: PackageTarget a -> [a] #

null :: PackageTarget a -> Bool #

length :: PackageTarget a -> Int #

elem :: Eq a => a -> PackageTarget a -> Bool #

maximum :: Ord a => PackageTarget a -> a #

minimum :: Ord a => PackageTarget a -> a #

sum :: Num a => PackageTarget a -> a #

product :: Num a => PackageTarget a -> a #

Traversable PackageTarget Source # 
Instance details

Defined in Distribution.Client.Targets

Methods

traverse :: Applicative f => (a -> f b) -> PackageTarget a -> f (PackageTarget b) #

sequenceA :: Applicative f => PackageTarget (f a) -> f (PackageTarget a) #

mapM :: Monad m => (a -> m b) -> PackageTarget a -> m (PackageTarget b) #

sequence :: Monad m => PackageTarget (m a) -> m (PackageTarget a) #

Functor PackageTarget Source # 
Instance details

Defined in Distribution.Client.Targets

Methods

fmap :: (a -> b) -> PackageTarget a -> PackageTarget b #

(<$) :: a -> PackageTarget b -> PackageTarget a #

Show pkg => Show (PackageTarget pkg) Source # 
Instance details

Defined in Distribution.Client.Targets

fetchPackageTarget :: Verbosity -> RepoContext -> PackageTarget (PackageLocation ()) -> IO (PackageTarget ResolvedPkgLoc) Source #

Fetch any remote targets so that they can be read.

readPackageTarget :: Verbosity -> PackageTarget ResolvedPkgLoc -> IO (PackageTarget UnresolvedSourcePackage) Source #

Given a package target that has been fetched, read the .cabal file.

This only affects targets given by location, named targets are unaffected.

reportPackageTargetProblems :: Verbosity -> [PackageTargetProblem] -> IO () Source #

Report problems to the user. That is, if there are any problems then raise an exception.

disambiguatePackageTargets :: Package pkg' => PackageIndex pkg' -> [PackageName] -> [PackageTarget pkg] -> ([PackageTargetProblem], [PackageSpecifier pkg]) Source #

Users are allowed to give package names case-insensitively, so we must disambiguate named package references.

disambiguatePackageName :: PackageNameEnv -> PackageName -> MaybeAmbiguous PackageName Source #

Given a package name and a list of matching names, figure out which one it might be referring to. If there is an exact case-sensitive match then that's ok (i.e. returned via Unambiguous). If it matches just one package case-insensitively or if it matches multiple packages case-insensitively, in that case the result is Ambiguous.

Note: Before cabal 2.2, when only a single package matched case-insensitively it would be considered Unambiguous.

User constraints

data UserQualifier Source #

Version of Qualifier that a user may specify on the command line.

Constructors

UserQualToplevel

Top-level dependency.

UserQualSetup PackageName

Setup dependency.

UserQualExe PackageName PackageName

Executable dependency.

Instances

Instances details
Structured UserQualifier Source # 
Instance details

Defined in Distribution.Client.Targets

Generic UserQualifier Source # 
Instance details

Defined in Distribution.Client.Targets

Associated Types

type Rep UserQualifier :: Type -> Type #

Show UserQualifier Source # 
Instance details

Defined in Distribution.Client.Targets

Binary UserQualifier Source # 
Instance details

Defined in Distribution.Client.Targets

Eq UserQualifier Source # 
Instance details

Defined in Distribution.Client.Targets

type Rep UserQualifier Source # 
Instance details

Defined in Distribution.Client.Targets

type Rep UserQualifier = D1 ('MetaData "UserQualifier" "Distribution.Client.Targets" "cabal-install-3.10.1.0-FbhGUvZ0l0XIx7QbOQfSVh" 'False) (C1 ('MetaCons "UserQualToplevel" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "UserQualSetup" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageName)) :+: C1 ('MetaCons "UserQualExe" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageName))))

data UserConstraintScope Source #

Version of ConstraintScope that a user may specify on the command line.

Constructors

UserQualified UserQualifier PackageName

Scope that applies to the package when it has the specified qualifier.

UserAnySetupQualifier PackageName

Scope that applies to the package when it has a setup qualifier.

UserAnyQualifier PackageName

Scope that applies to the package when it has any qualifier.

Instances

Instances details
Structured UserConstraintScope Source # 
Instance details

Defined in Distribution.Client.Targets

Generic UserConstraintScope Source # 
Instance details

Defined in Distribution.Client.Targets

Associated Types

type Rep UserConstraintScope :: Type -> Type #

Show UserConstraintScope Source # 
Instance details

Defined in Distribution.Client.Targets

Binary UserConstraintScope Source # 
Instance details

Defined in Distribution.Client.Targets

Eq UserConstraintScope Source # 
Instance details

Defined in Distribution.Client.Targets

type Rep UserConstraintScope Source # 
Instance details

Defined in Distribution.Client.Targets

data UserConstraint Source #

Version of PackageConstraint that the user can specify on the command line.

Instances

Instances details
Parsec UserConstraint Source # 
Instance details

Defined in Distribution.Client.Targets

Pretty UserConstraint Source # 
Instance details

Defined in Distribution.Client.Targets

Structured UserConstraint Source # 
Instance details

Defined in Distribution.Client.Targets

Generic UserConstraint Source # 
Instance details

Defined in Distribution.Client.Targets

Associated Types

type Rep UserConstraint :: Type -> Type #

Show UserConstraint Source # 
Instance details

Defined in Distribution.Client.Targets

Binary UserConstraint Source # 
Instance details

Defined in Distribution.Client.Targets

Eq UserConstraint Source # 
Instance details

Defined in Distribution.Client.Targets

type Rep UserConstraint Source # 
Instance details

Defined in Distribution.Client.Targets

type Rep UserConstraint = D1 ('MetaData "UserConstraint" "Distribution.Client.Targets" "cabal-install-3.10.1.0-FbhGUvZ0l0XIx7QbOQfSVh" 'False) (C1 ('MetaCons "UserConstraint" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UserConstraintScope) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageProperty)))