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

Safe Haskell | None
Language | Haskell2010

Distribution.Client.ProjectConfig.Legacy

Contents

- Project config in terms of legacy types
- Conversion to and from legacy config types
- Internals, just for tests

Description

Project configuration, implementation in terms of legacy types.

Synopsis

- type ProjectConfigSkeleton = CondTree ConfVar [ProjectConfigImport] ProjectConfig
- parseProjectSkeleton :: FilePath -> HttpTransport -> Verbosity -> [ProjectConfigImport] -> FilePath -> ByteString -> IO (ParseResult ProjectConfigSkeleton)
- instantiateProjectConfigSkeletonFetchingCompiler :: Monad m => m (OS, Arch, CompilerInfo) -> FlagAssignment -> ProjectConfigSkeleton -> m ProjectConfig
- instantiateProjectConfigSkeletonWithCompiler :: OS -> Arch -> CompilerInfo -> FlagAssignment -> ProjectConfigSkeleton -> ProjectConfig
- singletonProjectConfigSkeleton :: ProjectConfig -> ProjectConfigSkeleton
- projectSkeletonImports :: ProjectConfigSkeleton -> [ProjectConfigImport]
- data LegacyProjectConfig
- parseLegacyProjectConfig :: FilePath -> ByteString -> ParseResult LegacyProjectConfig
- showLegacyProjectConfig :: LegacyProjectConfig -> String
- commandLineFlagsToProjectConfig :: GlobalFlags -> NixStyleFlags a -> ClientInstallFlags -> ProjectConfig
- convertLegacyProjectConfig :: LegacyProjectConfig -> ProjectConfig
- convertLegacyGlobalConfig :: SavedConfig -> ProjectConfig
- convertToLegacyProjectConfig :: ProjectConfig -> LegacyProjectConfig
- parsePackageLocationTokenQ :: ReadP r String
- renderPackageLocationToken :: String -> String

# Documentation

type ProjectConfigSkeleton = CondTree ConfVar [ProjectConfigImport] ProjectConfig #

ProjectConfigSkeleton is a tree of conditional blocks and imports wrapping a config. It can be finalized by providing the conditional resolution info and then resolving and downloading the imports

parseProjectSkeleton :: FilePath -> HttpTransport -> Verbosity -> [ProjectConfigImport] -> FilePath -> ByteString -> IO (ParseResult ProjectConfigSkeleton) #

instantiateProjectConfigSkeletonFetchingCompiler :: Monad m => m (OS, Arch, CompilerInfo) -> FlagAssignment -> ProjectConfigSkeleton -> m ProjectConfig #

instantiateProjectConfigSkeletonWithCompiler :: OS -> Arch -> CompilerInfo -> FlagAssignment -> ProjectConfigSkeleton -> ProjectConfig #

singletonProjectConfigSkeleton :: ProjectConfig -> ProjectConfigSkeleton #

projectSkeletonImports :: ProjectConfigSkeleton -> [ProjectConfigImport] #

# Project config in terms of legacy types

data LegacyProjectConfig #

We already have parsers/pretty-printers for almost all the fields in the project config file, but they're in terms of the types used for the command line flags for Setup.hs or cabal commands. We don't want to redefine them all, at least not yet so for the moment we use the parsers at the old types and use conversion functions.

Ultimately if/when this project-based approach becomes the default then we can redefine the parsers directly for the new types.

#### Instances

Instances details

Monoid LegacyProjectConfig # |
Instance details Defined in Distribution.Client.ProjectConfig.Legacy Methods mempty :: LegacyProjectConfig # mappend :: LegacyProjectConfig -> LegacyProjectConfig -> LegacyProjectConfig # mconcat :: [LegacyProjectConfig] -> LegacyProjectConfig #
Semigroup LegacyProjectConfig # |
Instance details Defined in Distribution.Client.ProjectConfig.Legacy Methods (<>) :: LegacyProjectConfig -> LegacyProjectConfig -> LegacyProjectConfig # sconcat :: NonEmpty LegacyProjectConfig -> LegacyProjectConfig # stimes :: Integral b => b -> LegacyProjectConfig -> LegacyProjectConfig #
Generic LegacyProjectConfig # |
Instance details Defined in Distribution.Client.ProjectConfig.Legacy Associated Types
type Rep LegacyProjectConfig |
Instance details Defined in Distribution.Client.ProjectConfig.Legacy type Rep LegacyProjectConfig
Methods from :: LegacyProjectConfig -> Rep LegacyProjectConfig x # to :: Rep LegacyProjectConfig x -> LegacyProjectConfig #
Show LegacyProjectConfig # |
Instance details Defined in Distribution.Client.ProjectConfig.Legacy Methods showsPrec :: Int -> LegacyProjectConfig -> ShowS # show :: LegacyProjectConfig -> String # showList :: [LegacyProjectConfig] -> ShowS #
type Rep LegacyProjectConfig # |
Instance details Defined in Distribution.Client.ProjectConfig.Legacy type Rep LegacyProjectConfig

parseLegacyProjectConfig :: FilePath -> ByteString -> ParseResult LegacyProjectConfig #

showLegacyProjectConfig :: LegacyProjectConfig -> String #

# Conversion to and from legacy config types

commandLineFlagsToProjectConfig :: GlobalFlags -> NixStyleFlags a -> ClientInstallFlags -> ProjectConfig #

Convert configuration from the `cabal configure` or `cabal build` command line into a `ProjectConfig` value that can combined with configuration from other sources.

At the moment this uses the legacy command line flag types. See `LegacyProjectConfig` for an explanation.

convertLegacyProjectConfig :: LegacyProjectConfig -> ProjectConfig #

Convert the project config from the legacy types to the `ProjectConfig` and associated types. See `LegacyProjectConfig` for an explanation of the approach.

convertLegacyGlobalConfig :: SavedConfig -> ProjectConfig #

Convert from the types currently used for the user-wide Cabal config file into the `ProjectConfig` type.

Only a subset of the `ProjectConfig` can be represented in the user-wide config. In particular it does not include packages that are in the project, and it also doesn't support package-specific configuration (only configuration that applies to all packages).

convertToLegacyProjectConfig :: ProjectConfig -> LegacyProjectConfig #

# Internals, just for tests

parsePackageLocationTokenQ :: ReadP r String #

This is a bit tricky since it has to cover globs which have embedded `,` chars. But we don't just want to parse strictly as a glob since we want to allow http urls which don't parse as globs, and possibly some system-dependent file paths. So we parse fairly liberally as a token, but we allow `,` inside matched `{}` braces.

renderPackageLocationToken :: String -> String #