cabal-install
Safe HaskellNone
LanguageHaskell2010

Distribution.Client.ProjectConfig.Parsec

Description

Parsing project configuration.

Synopsis

Package configuration

parseProject Source #

Arguments

:: FilePath

The root of the project configuration, typically cabal.project

-> FilePath 
-> HttpTransport 
-> Verbosity 
-> ProjectConfigToParse

The contents of the file to parse

-> IO (ParseResult ProjectFileSource ProjectConfigSkeleton) 

Parses a project from its root config file, typically cabal.project.

data ProjectConfig Source #

This type corresponds directly to what can be written in the cabal.project file. Other sources of configuration can also be injected into this type, such as the user-wide config file and the command line of cabal configure or cabal build.

Since it corresponds to the external project file it is an instance of Monoid and all the fields can be empty. This also means there has to be a step where we resolve configuration. At a minimum resolving means applying defaults but it can also mean merging information from multiple sources. For example for package-specific configuration the project file can specify configuration that applies to all local packages, and then additional configuration for a specific package.

Future directions: multiple profiles, conditionals. If we add these features then the gap between configuration as written in the config file and resolved settings we actually use will become even bigger.

Constructors

ProjectConfig 

Fields

Instances

Instances details
Structured ProjectConfig Source # 
Instance details

Defined in Distribution.Client.ProjectConfig.Types

Binary ProjectConfig Source # 
Instance details

Defined in Distribution.Client.ProjectConfig.Types

NFData ProjectConfig Source # 
Instance details

Defined in Distribution.Client.ProjectConfig.Types

Methods

rnf :: ProjectConfig -> () #

Monoid ProjectConfig Source # 
Instance details

Defined in Distribution.Client.ProjectConfig.Types

Semigroup ProjectConfig Source # 
Instance details

Defined in Distribution.Client.ProjectConfig.Types

Generic ProjectConfig Source # 
Instance details

Defined in Distribution.Client.ProjectConfig.Types

Associated Types

type Rep ProjectConfig 
Instance details

Defined in Distribution.Client.ProjectConfig.Types

type Rep ProjectConfig = D1 ('MetaData "ProjectConfig" "Distribution.Client.ProjectConfig.Types" "cabal-install-3.18.1.0-inplace" 'False) (C1 ('MetaCons "ProjectConfig" 'PrefixI 'True) (((S1 ('MetaSel ('Just "projectPackages") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: S1 ('MetaSel ('Just "projectPackagesOptional") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String])) :*: (S1 ('MetaSel ('Just "projectPackagesRepo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [SourceRepoList]) :*: (S1 ('MetaSel ('Just "projectPackagesNamed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [PackageVersionConstraint]) :*: S1 ('MetaSel ('Just "projectConfigBuildOnly") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ProjectConfigBuildOnly)))) :*: ((S1 ('MetaSel ('Just "projectConfigShared") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ProjectConfigShared) :*: S1 ('MetaSel ('Just "projectConfigProvenance") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set ProjectConfigProvenance))) :*: (S1 ('MetaSel ('Just "projectConfigAllPackages") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageConfig) :*: (S1 ('MetaSel ('Just "projectConfigLocalPackages") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageConfig) :*: S1 ('MetaSel ('Just "projectConfigSpecificPackage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (MapMappend PackageName PackageConfig)))))))
Show ProjectConfig Source # 
Instance details

Defined in Distribution.Client.ProjectConfig.Types

Eq ProjectConfig Source # 
Instance details

Defined in Distribution.Client.ProjectConfig.Types

type Rep ProjectConfig Source # 
Instance details

Defined in Distribution.Client.ProjectConfig.Types

type Rep ProjectConfig = D1 ('MetaData "ProjectConfig" "Distribution.Client.ProjectConfig.Types" "cabal-install-3.18.1.0-inplace" 'False) (C1 ('MetaCons "ProjectConfig" 'PrefixI 'True) (((S1 ('MetaSel ('Just "projectPackages") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: S1 ('MetaSel ('Just "projectPackagesOptional") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String])) :*: (S1 ('MetaSel ('Just "projectPackagesRepo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [SourceRepoList]) :*: (S1 ('MetaSel ('Just "projectPackagesNamed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [PackageVersionConstraint]) :*: S1 ('MetaSel ('Just "projectConfigBuildOnly") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ProjectConfigBuildOnly)))) :*: ((S1 ('MetaSel ('Just "projectConfigShared") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ProjectConfigShared) :*: S1 ('MetaSel ('Just "projectConfigProvenance") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set ProjectConfigProvenance))) :*: (S1 ('MetaSel ('Just "projectConfigAllPackages") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageConfig) :*: (S1 ('MetaSel ('Just "projectConfigLocalPackages") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageConfig) :*: S1 ('MetaSel ('Just "projectConfigSpecificPackage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (MapMappend PackageName PackageConfig)))))))

Parsing

data ParseResult src a #

A monad with failure and accumulating errors and warnings.

Instances

Instances details
Applicative (ParseResult src) # 
Instance details

Defined in Distribution.Fields.ParseResult

Methods

pure :: a -> ParseResult src a #

(<*>) :: ParseResult src (a -> b) -> ParseResult src a -> ParseResult src b #

liftA2 :: (a -> b -> c) -> ParseResult src a -> ParseResult src b -> ParseResult src c #

(*>) :: ParseResult src a -> ParseResult src b -> ParseResult src b #

(<*) :: ParseResult src a -> ParseResult src b -> ParseResult src a #

Functor (ParseResult src) # 
Instance details

Defined in Distribution.Fields.ParseResult

Methods

fmap :: (a -> b) -> ParseResult src a -> ParseResult src b #

(<$) :: a -> ParseResult src b -> ParseResult src a #

Monad (ParseResult src) # 
Instance details

Defined in Distribution.Fields.ParseResult

Methods

(>>=) :: ParseResult src a -> (a -> ParseResult src b) -> ParseResult src b #

(>>) :: ParseResult src a -> ParseResult src b -> ParseResult src b #

return :: a -> ParseResult src a #

runParseResult :: ParseResult src a -> ([PWarningWithSource src], Either (Maybe Version, NonEmpty (PErrorWithSource src)) a) #

Destruct a ParseResult into the emitted warnings and either a successful value or list of errors and possibly recovered a spec-version declaration.