| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Distribution.Client.ProjectConfig.Parsec
Contents
Description
Parsing project configuration.
Synopsis
- parseProject :: FilePath -> FilePath -> HttpTransport -> Verbosity -> ProjectConfigToParse -> IO (ParseResult ProjectFileSource ProjectConfigSkeleton)
- data ProjectConfig = ProjectConfig {
- projectPackages :: [String]
- projectPackagesOptional :: [String]
- projectPackagesRepo :: [SourceRepoList]
- projectPackagesNamed :: [PackageVersionConstraint]
- projectConfigBuildOnly :: ProjectConfigBuildOnly
- projectConfigShared :: ProjectConfigShared
- projectConfigProvenance :: Set ProjectConfigProvenance
- projectConfigAllPackages :: PackageConfig
- projectConfigLocalPackages :: PackageConfig
- projectConfigSpecificPackage :: MapMappend PackageName PackageConfig
- data ParseResult src a
- runParseResult :: ParseResult src a -> ([PWarningWithSource src], Either (Maybe Version, NonEmpty (PErrorWithSource src)) a)
Package configuration
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
Parsing
data ParseResult src a #
A monad with failure and accumulating errors and warnings.
Instances
| Applicative (ParseResult src) # | |
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) # | |
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) # | |
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.