stack-0.1.0.0: The Haskell Tool Stack

Safe HaskellNone
LanguageHaskell2010

Stack.Types.Config

Description

The Config type.

Synopsis

Documentation

data Config Source

The top-level Stackage configuration.

Constructors

Config 

Fields

configStackRoot :: !(Path Abs Dir)

~/.stack more often than not

configDocker :: !DockerOpts
 
configEnvOverride :: !(EnvSettings -> IO EnvOverride)

Environment variables to be passed to external tools

configLocalPrograms :: !(Path Abs Dir)

Path containing local installations (mainly GHC)

configConnectionCount :: !Int

How many concurrent connections are allowed when downloading

configHideTHLoading :: !Bool

Hide the Template Haskell "Loading package ..." messages from the console

configPlatform :: !Platform

The platform we're building for, used in many directory names

configLatestSnapshotUrl :: !Text

URL for a JSON file containing information on the latest snapshots available.

configPackageIndices :: ![PackageIndex]

Information on package indices. This is left biased, meaning that packages in an earlier index will shadow those in a later index.

Warning: if you override packages in an index vs what's available upstream, you may correct your compiled snapshots, as different projects may have different definitions of what pkg-ver means! This feature is primarily intended for adding local packages, not overriding. Overriding is better accomplished by adding to your list of packages.

Note that indices specified in a later config file will override previous indices, not extend them.

Using an assoc list instead of a Map to keep track of priority

configSystemGHC :: !Bool

Should we use the system-installed GHC (on the PATH) if available? Can be overridden by command line options.

configInstallGHC :: !Bool

Should we automatically install GHC if missing or the wrong version is available? Can be overridden by command line options.

configLocalBin :: !(Path Abs Dir)

Directory we should install executables into

configRequireStackVersion :: !VersionRange

Require a version of stack within this range.

configJobs :: !Int

How many concurrent jobs to run, defaults to number of capabilities

configExtraIncludeDirs :: !(Set Text)
  • -extra-include-dirs arguments
configExtraLibDirs :: !(Set Text)
  • -extra-lib-dirs arguments

data PackageIndex Source

Information on a single package index

Constructors

PackageIndex 

Fields

indexName :: !IndexName
 
indexLocation :: !IndexLocation
 
indexDownloadPrefix :: !Text

URL prefix for downloading packages

indexGpgVerify :: !Bool

GPG-verify the package index during download. Only applies to Git repositories for now.

indexRequireHashes :: !Bool

Require that hashes and package size information be available for packages in this index

Instances

newtype IndexName Source

Unique name for a package index

Constructors

IndexName 

Instances

data IndexLocation Source

Location of the package index. This ensures that at least one of Git or HTTP is available.

Constructors

ILGit !Text 
ILHttp !Text 
ILGitHttp !Text !Text 

data EnvSettings Source

Controls which version of the environment is used

Constructors

EnvSettings 

Fields

esIncludeLocals :: !Bool

include local project bin directory, GHC_PACKAGE_PATH, etc

esIncludeGhcPackagePath :: !Bool

include the GHC_PACKAGE_PATH variable

data BuildConfig Source

A superset of Config adding information on how to build code. The reason for this breakdown is because we will need some of the information from Config in order to determine the values here.

Constructors

BuildConfig 

Fields

bcConfig :: !Config
 
bcResolver :: !Resolver

How we resolve which dependencies to install given a set of packages.

bcGhcVersionExpected :: !Version

Version of GHC we expected for this build

bcPackages :: !(Map (Path Abs Dir) Bool)

Local packages identified by a path, Bool indicates whether it is a non-dependency (the opposite of peExtraDep)

bcExtraDeps :: !(Map PackageName Version)

Extra dependencies specified in configuration.

These dependencies will not be installed to a shared location, and will override packages provided by the resolver.

bcRoot :: !(Path Abs Dir)

Directory containing the project's stack.yaml file

bcStackYaml :: !(Path Abs File)

Location of the stack.yaml file.

Note: if the STACK_YAML environment variable is used, this may be different from bcRoot / "stack.yaml"

bcFlags :: !(Map PackageName (Map FlagName Bool))

Per-package flag overrides

class HasBuildConfig r => HasEnvConfig r where Source

Instances

data LoadConfig m Source

Value returned by loadConfig.

Constructors

LoadConfig 

Fields

lcConfig :: !Config

Top-level Stack configuration.

lcLoadBuildConfig :: !(Maybe Resolver -> NoBuildConfigStrategy -> m BuildConfig)

Action to load the remaining BuildConfig.

lcProjectRoot :: !(Maybe (Path Abs Dir))

The project root directory, if in a project.

data PackageEntry Source

Constructors

PackageEntry 

Fields

peExtraDepMaybe :: !(Maybe Bool)

Is this package a dependency? This means the local package will be treated just like an extra-deps: it will only be built as a dependency for others, and its test suite/benchmarks will not be run.

Useful modifying an upstream package, see: https:/github.comcommercialhaskellstackissues/219 https:/github.comcommercialhaskellstackissues/386

peValidWanted :: !(Maybe Bool)

Deprecated name meaning the opposite of peExtraDep. Only present to provide deprecation warnings to users.

peLocation :: !PackageLocation
 
peSubdirs :: ![FilePath]
 

Instances

peExtraDep :: PackageEntry -> Bool Source

Once peValidWanted is removed, this should just become the field name in PackageEntry.

data PackageLocation Source

Constructors

PLFilePath FilePath

Note that we use FilePath and not Paths. The goal is: first parse the value raw, and then use canonicalizePath and parseAbsDir.

PLHttpTarball Text 
PLGit Text Text

URL and commit

data Project Source

A project is a collection of packages. We can have multiple stack.yaml files, but only one of them may contain project information.

Constructors

Project 

Fields

projectPackages :: ![PackageEntry]

Components of the package list

projectExtraDeps :: !(Map PackageName Version)

Components of the package list referring to package/version combos, see: https:/github.comfpcostackissues/41

projectFlags :: !(Map PackageName (Map FlagName Bool))

Per-package flag overrides

projectResolver :: !Resolver

How we resolve which dependencies to use

Instances

Show Project 
ToJSON Project 

data Resolver Source

How we resolve which dependencies to install given a set of packages.

Constructors

ResolverSnapshot SnapName

Use an official snapshot from the Stackage project, either an LTS Haskell or Stackage Nightly

ResolverGhc !MajorVersion

Require a specific GHC major version, but otherwise provide no build plan. Intended for use cases where end user wishes to specify all upstream dependencies manually, such as using a dependency solver.

Instances

Show Resolver 
ToJSON Resolver 
FromJSON Resolver 

renderResolver :: Resolver -> Text Source

Convert a Resolver into its Text representation, as will be used by JSON/YAML

parseResolver :: MonadThrow m => Text -> m Resolver Source

Try to parse a Resolver, using same format as JSONYAMLrenderResolver

class HasStackRoot env where Source

Class for environment values which have access to the stack root

Minimal complete definition

Nothing

Methods

getStackRoot :: env -> Path Abs Dir Source

class HasPlatform env where Source

Class for environment values which have a Platform

Minimal complete definition

Nothing

Methods

getPlatform :: env -> Platform Source

class (HasStackRoot env, HasPlatform env) => HasConfig env where Source

Class for environment values that can provide a Config.

Minimal complete definition

Nothing

Methods

getConfig :: env -> Config Source

class HasConfig env => HasBuildConfig env where Source

Class for environment values that can provide a BuildConfig.

newtype VersionRangeJSON Source

Newtype for non-orphan FromJSON instance.

Instances

FromJSON VersionRangeJSON

Parse VersionRange.

askConfig :: (MonadReader env m, HasConfig env) => m Config Source

Helper function to ask the environment and apply getConfig

askLatestSnapshotUrl :: (MonadReader env m, HasConfig env) => m Text Source

Get the URL to request the information on the latest snapshots

configPackageIndexRoot :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> m (Path Abs Dir) Source

Root for a specific package index

configPackageIndexCache :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> m (Path Abs File) Source

Location of the 00-index.cache file

configPackageIndex :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> m (Path Abs File) Source

Location of the 00-index.tar file

configPackageIndexGz :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> m (Path Abs File) Source

Location of the 00-index.tar.gz file

configPackageTarball :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> PackageIdentifier -> m (Path Abs File) Source

Location of a package tarball

workDirRel :: Path Rel Dir Source

configProjectWorkDir :: (HasBuildConfig env, MonadReader env m) => m (Path Abs Dir) Source

Per-project work dir

configInstalledCache :: (HasBuildConfig env, MonadReader env m) => m (Path Abs File) Source

File containing the installed cache, see Stack.PackageDump

platformRelDir :: (MonadReader env m, HasPlatform env, MonadThrow m) => m (Path Rel Dir) Source

Relative directory for the platform identifier

configShakeFilesDir :: (MonadReader env m, HasBuildConfig env) => m (Path Abs Dir) Source

Path to .shake files.

configLocalUnpackDir :: (MonadReader env m, HasBuildConfig env) => m (Path Abs Dir) Source

Where to unpack packages for local build

snapshotsDir :: (MonadReader env m, HasConfig env, MonadThrow m) => m (Path Abs Dir) Source

Directory containing snapshots

installationRootDeps :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) Source

Installation root for dependencies

installationRootLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) Source

Installation root for locals

packageDatabaseDeps :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) Source

Package database for installing dependencies into

packageDatabaseLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) Source

Package database for installing local packages into

flagCacheLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) Source

Directory for holding flag cache information

configMiniBuildPlanCache :: (MonadThrow m, MonadReader env m, HasStackRoot env, HasPlatform env) => SnapName -> m (Path Abs File) Source

Where to store mini build plan caches

bindirSuffix :: Path Rel Dir Source

Suffix applied to an installation root to get the bin dir

docdirSuffix :: Path Rel Dir Source

Suffix applied to an installation root to get the doc dir

extraBinDirs :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Bool -> [Path Abs Dir]) Source

Get the extra bin directories (for the PATH). Puts more local first

Bool indicates whether or not to include the locals

getMinimalEnvOverride :: (MonadReader env m, HasConfig env, MonadIO m) => m EnvOverride Source

Get the minimal environment override, useful for just calling external processes like git or ghc

packageEntryCurrDir :: PackageEntry Source

A PackageEntry for the current directory, used as a default